微信小程序——婚礼邀请函页面

这篇具有很好参考价值的文章主要介绍了微信小程序——婚礼邀请函页面。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、主体页面和导航栏样式app.json

 

  "pages": [
    "pages/index/index",
    "pages/picture/picture",
    "pages/video/video",
    "pages/map/map",
    "pages/guest/guest"
  ],
  "requiredBackgroundModes": ["audio"],
  "window": {
    "navigationBarBackgroundColor": "#ff4c91",
    "navigationBarTextStyle": "white",
    "backgroundTextStyle": "light",
    "enablePullDownRefresh": false
  },

其中"requiredBackgroundModes": ["audio"]为音乐播放配置

2、底部标签栏

tabBar用于实现页面底部的标签栏,主要属性如下,其中list是一个数组,数组中的每一个元素都是一个标签按钮对象,设置对应的属性时,可以跳转到对应的标签页。

属性 说明
color 未选择时,底部导航栏颜色
selectedColor 选中时,底部导航栏颜色
borderStyle 底部导航边框颜色
backgroundColor 底部导航背景色
list 导航配置数组
pagePath 页面访问地址
iconPath 未选择时图片路径
selectedIconPath 选中时图片路径
text 导航图标下方文字

3、在app.json中添加如下代码,完成标签栏的配置

"tabBar": {
    "color": "black",
    "selectedColor": "#ff4c91",
    "borderStyle": "white",
    "backgroundColor": "#ffffff",
    "list": [
      {
        "pagePath": "pages/index/index",
        "iconPath": "images/invite.png",
        "selectedIconPath": "images/invite.png",
        "text": "邀请函"
      },
      {
        "pagePath": "pages/picture/picture",
        "iconPath": "images/marry.png",
        "selectedIconPath": "images/marry.png",
        "text": "照片"
      },
      {
        "pagePath": "pages/video/video",
        "iconPath": "images/video.png",
        "selectedIconPath": "images/video.png",
        "text": "美好时光"
      },
      {
        "pagePath": "pages/map/map",
        "iconPath": "images/map.png",
        "selectedIconPath": "images/map.png",
        "text": "婚礼地点"
      },
      {
        "pagePath": "pages/guest/guest",
        "iconPath": "images/guest.png",
        "selectedIconPath": "images/guest.png",
        "text": "宾客信息"
      }
    ]
  },

4、页面的公共样式app.wxss

page{
  font-family: Helvetica Neue,Arial, Helvetica, sans-serif ;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

 justify-content: space-between;使各项周围都留有空白

5、邀请函的内部结构index.wxss

<!-- 显示歌曲播放暂停的小图标 -->
<view class="player player-{{isPlayingMusic ? 'play':'pause'}}" bindtap="play">
   <image src="/images/music_icon.jpg"></image>
   <image src="/images/music_play.png"></image>
</view>
<!-- 背景图片 -->
<image class="bg" src="/images/bg_1.png"></image>
<!-- 内容区域 -->
<view class="content">
<!-- 顶部图片区域 -->
   <image class="content-gif" src="/images/save_the_date.gif"></image>
   <!-- 标题 -->
   <view class="content-title">邀请函</view>
   <!-- 新郎和新娘合照 -->
   <view class="content-avatar">
      <image src="/images/avatar.png"></image>
   </view>
   <!-- 新郎和新娘的名字 -->
   <view class="content-info">
      <view class="content-name" bindtap="callGroom">
         <image src="/images/tel.png"></image>
         <view>王小名</view>
         <view>新郎</view>
      </view>
      <view class="content-wedding">
         <image src="/images/wedding.png"></image>
      </view>
      <view class="content-name" bindtap="callBride">
         <image src="/images/tel.png"></image>
         <view>张小红</view>
         <view>新娘</view>
      </view>
   </view>
   <!-- 婚礼信息 -->
   <view class="content-address">
         <view>我们曾邀你来参加我们的婚礼</view>
         <view>时间:2021年10月11</view>
         <view>地点:河南省周口市曦皇大酒店</view>
      </view>

</view>

6、样式控制

/* 显示歌曲播放暂停的小图标 */
.player{
  position: fixed;
  top:20rpx;
  right:20rpx;
  /* 元素的堆叠顺序,防止被content中的内容覆盖在下面 */
  z-index: 1;
}
.player>image:first-child{
  width: 80rpx;
  height: 80rpx;
  border: 1rpx solid #ffffff;
  border-radius: 50%;
  /* 将动画与div绑定,musicRotate只是起的一个名字 */
 animation: musicRotate 3s linear infinite;
}
/* 对唱胶动画设置 */
@keyframes musicRotate{
  from{
    transform: rotate(0deg);
  }
  to{
    transform: rotate(360deg);
  }
}
.player>image:last-child{
  width: 28rpx;
  height:80rpx;
  margin-left: -5px;
}
/* 对唱胶图标设置旋转和暂停以及唱臂的移入和移出 */
.player-play>image:first-child{
  animation-play-state: running;
}
.player-pause>image:last-child{
  animation: musicStart 0.2s linear forwards;
}
.player-pause>image:first-child{
  animation-play-state: paused;
}
.player-pause>image:last-child{
  animation: musicStop 0.2 linear forwards;
}
@keyframes musicStart{
  from{
    transform: rotate(0deg);
  }
  to{
    transform: rotate(20deg);
  }
}
@keyframes musicStop{
  from{
    transform: rotate(20deg);
  }
  to{
    transform: rotate(0deg);
  }
}
/* 背景图片 */
.bg{
  width: 100vw;
  height: 100vh;
}
.content{
  width: 100vw;
  height: 100vh;
  /* 绝对定位元素,相对于浏览器 */
  position: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.content-gif{
  width: 19vh;
  height: 18.6vh;
  margin-bottom: 1.5vh;
}
.content-title{
  font-size: 5vh;
  color: #ff4c91;
  text-align: center;
  margin-bottom: 2.5vh;
}
/* 新郎新娘合照 */
.content-avatar image{
  width: 24vh;
  height: 24vh;
  border: 3rpx solid #ff4c91;
  border-radius: 50%;
}
/* 新郎新郎电话区 */
.content-info{
  width:45vh;
  text-align: center;
  margin-top: 4vh;
  display: flex;
  align-items: center;
}
.content-wedding{
  flex: 1;
}
.content-wedding>image{
  width:5.5vh;
  height:5.5vh;
  margin-left: 20rpx;
}
.content-name{
  color: #ff4c91;
  font-size: 2.7vh;
  line-height: 4.5vh;
  font-weight: bold;
  position: relative;
}
.content-name>image{
  width: 2.6vh;
  height: 2.6vh;
  border: 1px solid #ff4c91;
  border-radius: 50%;
  position: absolute;
  top:-1vh;
  right:-3.6vh;
}
.content-address{
  margin-top: 5vh;
  color: #ec5f89;
  font-size: 2.5vh;
  font-weight: bold;
  text-align: center;
  line-height: 4.5vh;
}
.content-address view:first-child{
  font-size: 3vh;
  padding-bottom: 2vh;
}

 7、在index.js中编写背景音频播放的代码

  bgm:null,
  music_url:'http://localhost:3000/1.mp3',
  music_coverImgUrl:"http://localhost:3000/cover.jpg",
  onReady:function () {
    //用于播放背景音频
    this.bgm=wx.getBackgroundAudioManager()
    this.bgm.title="marry me"
    this.bgm.epname="wedding"
    this.bgm.singer="singer"
    this.bgm.coverImgUrl=this.music_coverImgUrl
    this.bgm.onCanplay(()=>{
      this.bgm.pause()
    })
    this.bgm.src=this.music_url
  },

8、实现单击播放器实现音乐的播放与暂停,在index.js中添加如下代码

  play:function(e){
    if(this.data.isPlayingMusic){
      this.bgm.pause()
    }else{
      this.bgm.play()
    }
    this.setData({
      isPlayingMusic: !this.data.isPlayingMusic
    })
  },

9、实现一键拨打电话的功能

 callGroom:function(){
    wx.makePhoneCall({
      phoneNumber: '15138726924',
    })
  },
  callBride:function(){
    wx.makePhoneCall({
      phoneNumber: '18236347304',
    })
  }

10、页面最终运行效果如图

微信小程序——婚礼邀请函页面

微信小程序——婚礼邀请函页面

婚礼邀请函图片获取资源

链接: https://pan.baidu.com/s/1OcI_KBEXx-WYJv9srXlWAw 提取码: jwwg 文章来源地址https://www.toymoban.com/news/detail-426368.html

到了这里,关于微信小程序——婚礼邀请函页面的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 婚礼邀请函小程序项目

    项目展示、项目分析、项目初始化 照片页面 美好时光页面 宾客信息页面 在微信开发者工具中创建一个空白项目。创建成功后,新建app.json文件,在该文件中定义本项目中的页面路径、定义项目导航栏样式、定义项目底部标签栏 2.1 背景音乐功能 在index.wxml设置页面和展示图片

    2024年02月06日
    浏览(23)
  • “婚礼邀请函”小程序开发过程

    要求该小程序有以下功能: 1.邀请函页面:新郎和新娘的电话、婚礼时间、婚礼地点 2.照片页面:新郎和新娘的幸福照 3.美好时光页面:采用视频的方式记录新人的相历程 4.地图页面:通导航查看婚礼地点的路线图 5.宾客信息页面:参加婚礼的宾客填写个人信息,送给一些祝

    2024年02月10日
    浏览(25)
  • 杭州-区块链前瞻性论坛邀请函​

    2023密码与安全前瞻性论坛邀请函

    2024年02月04日
    浏览(34)
  • html5实现好看的年会邀请函源码模板

    作者:xcLeigh 文章地址:https://blog.csdn.net/weixin_43151418/article/details/135720875 html5实现好看的年会邀请函源码模板 ,十个界面效果,邀请函、诚挚邀请、关于我们、董事长致词、公司合作方、活动流程、加盟支持、加盟流程、加盟申请、活动信息等。界面展示图文时支持自己设置

    2024年01月21日
    浏览(30)
  • 邀请函 | 区块链如何助力公益?腾讯、深大、微众专家齐聚ESG系列研讨会

    9月5日是我国第七个“中华慈善日”。作为全球最大的公益节日之一,2022年腾讯99公益日也已正式启动。其中,腾讯公益基于腾讯安全区块链,联合企业、行业协会、监管部门打造了公益信用联盟链,由微众区块链提供开源技术支持。 对于公益事业而言,善款去向、信息透明

    2024年02月12日
    浏览(40)
  • 师承AI世界新星|7天获新加坡南洋理工大学访学邀请函

    能够拜师在“人工智能 10 大新星”名下,必定可以学习到前沿技术,受益良多,本案例中的 C 老师无疑就是这个幸运儿。我们只用了 7 天时间就取得了这位 AI 新星导师的邀请函,最终 C 老师顺利获批 CSC ,如愿出国。 C 老师背景: 申请类型: CSC访学 工作背景: 高校老师 教

    2024年02月16日
    浏览(35)
  • 微信小程序主体迁移

            由于公司经营要求,会出现将一个小程序的主体从A公司迁移到B公司的需求,本人全称操作了一次小程序的主体迁移,将迁移过程遇到的坑分享给大家,力求在做迁移的时候用最短的时间,对线上小程序影响最小。不多说,下面进入正题:         1,登录要迁

    2024年02月09日
    浏览(23)
  • 微信小程序与公众号关联(同一主体),获取unionId并关联公众号openid

    有一些同学在实际开发中,会有通过微信的openid获取公众号的openid,或者其他内容,这几天正好在研究这个功能的实现(已实现),现做思路上的简单分享,希望能对需要解决该问题的同学有所帮助,有误之处敬请指正。 工具/语言/依赖 版本 备注 uniapp 2023-12 Springboot 2.1.12.

    2024年04月14日
    浏览(24)
  • Java后台实现网站微信扫码登录功能,获取用户openid,及微信用户信息(小程序码方案),关联微信小程序(个人主体小程序也可以)

    目录 前言 下面展示操作流程 注册微信小程序 通过后台获取小程序码 前端处理 时序图理解 方案实现步骤 前言 很多业务场景之下我们需要实现  微信扫码登录  的需求,如: 同步网站与小程序的用户数据 。 需要获取用户微信相关基本信息,如头像、id等 实例:小程序上的

    2024年02月02日
    浏览(42)
  • 微信小程序 全局配置||微信小程序 页面配置||微信小程序 sitemap配置

    小程序根目录下的 app.json 文件用来对微信小程序进行全局配置,决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。 以下是一个包含了部分常用配置选项的 app.json : 每一个小程序页面也可以使用同名 .json 文件来对本页面的窗口表现进行配置,页面中配

    2024年02月01日
    浏览(32)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包