废话不多说,开源地址:https://www.ziyuanhe.cn/essay/4430(不想复制可以到这里下载)
首先这个是一个带后台得服务端。从0到1构建的小程序
注意注意最最下面有代码
演示小程序
演示图
小程序端
界面就是这样的。
代码专区(考虑到有地址,所以只展示部分代码,我太懒了)
<view class="index">
<view style="width: 100%;margin-top: 30rpx;">
<view style="font-size: 22px;">每日任务</view>
<view style="color: #47494b;font-size: 12px;">完成任务获得额外奖励</view>
<view style="display: flex;margin-top: 30rpx;flex-wrap: wrap;background: rgb(255, 255, 255);padding: 30rpx;border: 1px solid #efefef;border-radius: 8rpx;">
<view style="width: 100%;display: flex;">
<view style="width: 60%;display: flex;align-items: center;flex-wrap: wrap;">
<view style="display: flex;width: 100%;">
<view style="background-image: linear-gradient(135deg,#fb6c4e,#f94b45);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;font-size: 11px;margin-right: 6px;padding: 1px 4px;">hot</view>
<view>邀请新用户</view>
</view>
<view style="display: flex;width: 100%;font-size: 22rpx;margin-top: 20rpx;">
<view style="background-image: linear-gradient(135deg,#65a8ff,#542dff);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;margin-right: 6px;padding: 1px 4px;">UP</view>
<view>邀请一人奖励100次</view>
</view>
</view>
<view style="width: 40%;display: flex;align-items: center;justify-content: center;">
<button style="background-color: transparent;"openType="share">
<view style="width: 60%;margin: auto;background: rgb(255, 255, 255);background: #3030FF;color: white;border-radius: 12rpx;">去邀请</view>
</button>
</view>
</view>
</view>
<!----->
<view style="display: flex;margin-top: 30rpx;flex-wrap: wrap;background: rgb(255, 255, 255);padding: 30rpx;border: 1px solid #efefef;border-radius: 8rpx;">
<view style="width: 100%;display: flex;">
<view style="width: 60%;display: flex;align-items: center;flex-wrap: wrap;">
<view style="display: flex;width: 100%;">
<view style="background-image: linear-gradient(135deg,#fb6c4e,#f94b45);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;font-size: 11px;margin-right: 6px;padding: 1px 4px;">hot</view>
<view>每天签到</view>
</view>
<view style="display: flex;width: 100%;font-size: 22rpx;margin-top: 20rpx;">
<view style="background-image: linear-gradient(135deg,#65a8ff,#542dff);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;margin-right: 6px;padding: 1px 4px;">UP</view>
<view>每天签到下发一次奖励</view>
</view>
</view>
<view style="width: 40%;display: flex;align-items: center;justify-content: center;">
<button style="background-color: transparent;">
<view bindtap="pddl" style="width: 60%;margin: auto;background: rgb(255, 255, 255);background: #3030FF;color: white;border-radius: 12rpx;">去签到</view>
</button>
</view>
</view>
</view>
<!------>
<view style="display: flex;margin-top: 30rpx;flex-wrap: wrap;background: rgb(255, 255, 255);padding: 30rpx;border: 1px solid #efefef;border-radius: 8rpx;display: none;">
<view style="width: 100%;display: flex;">
<view style="width: 60%;display: flex;align-items: center;flex-wrap: wrap;">
<view style="display: flex;width: 100%;">
<view style="background-image: linear-gradient(135deg,#fb6c4e,#f94b45);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;font-size: 11px;margin-right: 6px;padding: 1px 4px;">hot</view>
<view>每天看一次广告</view>
</view>
<view style="display: flex;width: 100%;font-size: 22rpx;margin-top: 20rpx;">
<view style="background-image: linear-gradient(135deg,#65a8ff,#542dff);border-radius: 2rpx; border-radius: 4px;box-shadow: 2px 2px 2px 1px rgba(249,75,69,.2);color: #fff;margin-right: 6px;padding: 1px 4px;">UP</view>
<view>观看广告完成后下发10次奖励</view>
</view>
</view>
<view style="width: 40%;display: flex;align-items: center;justify-content: center;">
<button style="background-color: transparent;">
<view bindtap="kf" style="width: 60%;margin: auto;background: rgb(255, 255, 255);background: #3030FF;color: white;border-radius: 12rpx;">去观看</view>
</button>
</view>
</view>
</view>
</view>
</view>
.index {
background-color: #fff;
padding: 0 35rpx;
position: relative;
}
.top {
padding: 20rpx 0;
}
.title {
color: #656565;
font-size: 60rpx;
font-weight: 650;
letter-spacing: 5rpx;
}
.result {
display: flex;
margin: 20rpx 0;
}
.txt {
color: #656565;
font-size: 35rpx;
font-weight: 700;
}
.detail {
height: 100vh;
margin: 60rpx 35rpx;
}
.punch {
letter-spacing: 6rpx;
margin: 40rpx 0;
}
.punch_text {
color: #656565;
font-size: 22rpx;
font-weight: 400;
line-height: 15px;
}
.text_c {
color: #07c160;
}
.text_c,.text_cc {
display: inline-block;
font-weight: 650;
}
.text_cc {
color: #ec2a2a;
}
.punch_title {
color: #656565;
font-size: 25rpx;
font-weight: 700;
margin-bottom: 30rpx;
}
.punch_coun {
display: flex;
font-size: small;
margin: 30rpx 0;
}
.punch_copy,.title {
color: #07c160;
}
.title {
font-size: 45rpx;
font-weight: 700;
margin-bottom: 30rpx;
text-align: center;
}
.container {
flex-wrap: wrap;
justify-content: space-between;
margin: 40rpx 0 20rpx;
}
.container,.content {
display: flex;
}
.content {
background-color: #f8f8f8;
border-radius: 20rpx;
box-shadow: 0 0 .8px #c1d3ea;
height: 100rpx;
margin: 25rpx 0;
width: 44%;
}
.content,.file {
line-height: 100rpx;
}
.file {
text-align: center;
width: 100%;
}
.images1 {
height: 15rpx;
margin-right: 30rpx;
margin-top: 4PX;
width: 15rpx;
}
.graee {
background-color: #07c160;
}
.share {
border-radius: 25rpx;
line-height: 60rpx;
}
.text1 {
color: #fff;
}
button {
background-color: #f8f8f8;
border-radius: 25rpx;
margin: 0;
padding: 0;
}
image {
height: 45rpx;
margin-right: 20rpx;
vertical-align: middle;
width: 45rpx;
}
.copy {
height: 35rpx;
margin-right: 15rpx;
width: 35rpx;
}
.text {
display: inline-block;
font-size: 32rpx;
font-weight: 500;
}
.public {
background-color: #fff;
color: #c0bdbd;
font-size: 30rpx;
}
.Praise,.public {
text-align: center;
}
.Praise {
height: 140rpx;
position: relative;
width: 100%;
}
@keyframes box-ani {
from {transform: rotate(0)}
to {transform: rotate(360deg)}
}
.songimg{
border-radius:50%;
position: relative;
/* margin-left: -30rpx; */
}
.Praise_img {
left: 26%;
margin: 0;
position: absolute;
}
.count {
color: #07c160;
padding: 0 10rpx;
}
.typexx {
background-color: #f8f8f8;
border-radius: 15rpx;
box-shadow: 0 0rpx 1rpx rgba(0,0,0,.04);
display: flex;
padding-top: 0;
position: relative;
width: 100%;
}
.search {
background-color: #f8f8f8;
border-radius: 15rpx;
box-shadow: 0 0rpx 1rpx rgba(0,0,0,.04);
display: flex;
height: 100rpx;
padding-top: 0;
position: relative;
width: 100%;
}
.delete {
display: block;
right: 17%;
top: 38%;
z-index: 10;
}
.del,.delete {
position: absolute;
}
.del {
height: 25rpx;
right: -9rpx;
top: 20%;
width: 25rpx;
}
input {
background-color: #f8f8f8;
border-radius: 15rpx;
display: block;
font-size: 35rpx;
height: 100%;
padding-left: 34rpx;
position: relative;
width: 72%;
}
button:not([size="mini"]) {
border-radius: 8rpx;
}
.glass {
display: inline-block;
height: 50rpx;
line-height: 100rpx;
position: absolute;
right: 8rpx;
text-align: center;
}
.single {
background-color: #f8f8f8;
border-radius: 15rpx;
box-shadow: 0 0rpx 1rpx rgba(0,0,0,.04);
height: 150rpx;
margin: 30rpx 0;
width: 100%;
}
.single_content {
justify-content: space-between;
padding: 35rpx 25rpx;
}
.single_content,.single_l {
display: flex;
}
.single_l {
width: 83%;
}
.single_l image {
height: 80rpx;
width: 80rpx;
}
.single_c {
margin-left: 30rpx;
overflow: hidden;
text-overflow: ellipsis;
width: 80%;
}
.name {
font-size: 28rpx;
font-weight: 600;
white-space: nowrap;
width: 100%;
}
.file {
color: #656565;
font-size: 20rpx;
font-weight: 400;
margin-top: 10rpx;
}
.single_r {
line-height: 90rpx;
text-align: center;
width: 10%;
}
.single_r image {
height: 40rpx;
width: 40rpx;
}
.down {
height: 80rpx;
margin: 20rpx 0;
position: relative;
width: 100%;
}
.ad {
bottom: 8%;
position: fixed;
right: 4%;
width: 30%;
}
.down_text {
color: #a9a9a9;
font-size: 30rpx;
line-height: 80rpx;
position: absolute;
text-align: center;
width: 100%;
}