“婚礼邀请函”微信小程序由4个页面组成,分别是“邀请函”页面、“照片”页面、“美好时光”页面和“宾客信息”页面。每个页面顶部的导航栏和底部的标签栏是公共部分,在每个页面中都会出现;页面中间的部分是页面内容,每个页面的内容都不同。
app.json
中添加tabBar
配置项即可实现标签栏配置。var express = require('express');//导入Express框架
var app = express();//创建Express框架的实例
app.use(express.static('./htdocs'));//设置静态资源目录
app.listen(8088, res => {//服务器监听8088端口
console.log('服务器启动成功,访问地址:http://localhost:8088/文件名');
});
"tabBar": {
"color": "#ccc",
"selectedColor": "#ff4c91",
"borderStyle": "white",
"backgroundColor": "#fff",
"list":[
{
"pagePath": "pages/index/index",
"iconPath": "images/invite.png",
"selectedIconPath": "images/invite.png",
"text": "邀请函"
},
{
"pagePath": "pages/photo/photo",
"iconPath": "images/marry.png",
"selectedIconPath": "images/marry.png",
"text": "照片"
},
{
"pagePath": "pages/time/time",
"iconPath": "images/video.png",
"selectedIconPath": "images/video.png",
"text": "美好时光"
},
{
"pagePath": "pages/guest/guest",
"iconPath": "images/guest.png",
"selectedIconPath": "images/guest.png",
"text": "宾客信息"
}
]
},
<image class="bg" src="/images/bg1.jpg"/>
<view class="content">
<view class="content-title">邀请函view>
<view class="content-avatar">
<image src="/images/avatar2.png"/>
view>
<view class="content-info">
<view class="content-name">
<image src="/images/tel.png"/>
<view>杨亚东view>
<view>新郎view>
view>
<view class="content-wedding">
<image src="/images/wedding.png"/>
view>
<view class="content-name">
<image src="/images/tel.png"/>
<view>陈慧敏view>
<view>新娘view>
view>
view>
<view class="content-address">
<view>我们诚邀您来参加我们的婚礼view>
<view>时间:2024年1月1日view>
<view>地点:龙马潭区龙涧假日酒店view>
view>
view>
/* 内容区域的外部容器样式 */
.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: 3px solid #ff4c91;
border-radius: 50%;
}
/* 新郎与新娘区域样式 */
.content-info {
width: 45vw;
text-align: center;
margin-top: 4vh;
display: flex;
flex-direction: row;
align-items: center;
}
/* 新郎和新娘姓名样式 */
.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-wedding {
flex: 1;
}
.content-wedding > image {
width: 5.5vh;
height: 5.5vh;
margin-left: 1.5vh;
}
<swiper indicator-color="white" indicator-active-color="#ff4c91" indicator-dots="true"
autoplay="true" interval="3000" duration="1000" vertical="true" circular="true">
<swiper-item>
<image src="/images/timeg1.png"/>
swiper-item>
<swiper-item>
<image src="/images/timeg2.png"/>
swiper-item>
<swiper-item>
<image src="/images/timeg3.png"/>
swiper-item>
<swiper-item>
<image src="/images/timeg4.png"/>
swiper-item>
swiper>
/* 设置轮播组件的高度 */
swiper {
height: 100vh;
}
/* 设置轮播图片的尺寸 */
image {
width: 100vw;
height: 100vh;
}
<view class="video">
<view class="video-title">标题:海边随拍view>
<view class="video-time">拍摄日期:2023-08-15view>
<video src="http://localhost:8088/01.mp4" object-fit="fill"/>
view>
<view class="video">
<view class="video-title">标题:勿忘初心view>
<view class="video-time">拍摄日期:2023-10-1view>
<video src="http://localhost:8088/02.mp4" object-fit="fill"/>
view>
<view class="video">
<view class="video-title">标题:十年之约view>
<view class="video-time">拍摄日期:2023-10-15view>
<video src="http://localhost:8088/03.mp4" object-fit="fill"/>
view>
/* pages/time/time.wxss */
/* 外层view组件样式 */
.video {
box-shadow: 0 8rpx 17rpx 0 rgba(7, 17, 27, 0.1);
margin: 10rpx 25rpx;
margin-bottom: 30rpx;
padding: 20rpx;
border-radius: 10rpx;
background: #eee;
}
/* 标题区域样式 */
.video-title {
font-size: 35rpx;
color: #555;
}
/* 拍摄日期区域样式 */
.video-time {
font-size: 26rpx;
color: #888;
}
/* 视频区域样式 */
.video video {
width: 100%;
margin-top: 20rpx;
}
<image class="bg" src="/images/bg2.jpg"/>
<form>
<view class="content">
<view class="name">
<input name="name" placeholder-class="phcolor" placeholder="请输入您的姓名"/>
view>
<view class="telephone">
<input name="telephone" placeholder-class="phcolor" placeholder="请输入您的手机号码"/>
view>
<view class="gender">
<text>请选择您的性别:text>
<radio-group>
<radio>男radio>
<radio>女radio>
radio-group>
view>
<view class="dessert">
<text>请选择您需要的点心:text>
<checkbox-group>
<checkbox>蛋糕checkbox>
<checkbox>甜甜圈checkbox>
<checkbox>巧克力checkbox>
checkbox-group>
view>
<button>提交button>
view>
form>
在guest.wxss
文件里定义.content .name
样式类
查看预览效果
在guest.wxss
文件里定义.content .telephone
样式类
查看预览效果