第一题
//js
Page({
onLoad: function (options) {
const ctx = wx.createCanvasContext('txw');
const colors = ["blue", "black", "red", "yellow","green" ];
ctx.beginPath();
ctx.arc(50, 50, 40, 0, 2 * Math.PI);
ctx.setStrokeStyle(colors[0]);
ctx.stroke();
ctx.beginPath();
ctx.arc(110, 50, 40, 0, 2 * Math.PI);
ctx.setStrokeStyle(colors[1]);
ctx.stroke();
ctx.beginPath();
ctx.arc(170, 50, 40, 0, 2 * Math.PI);
ctx.setStrokeStyle(colors[2]);
ctx.stroke();
ctx.beginPath();
ctx.arc(80, 90, 40, 0, 2 * Math.PI);
ctx.setStrokeStyle(colors[3]);
ctx.stroke();
ctx.beginPath();
ctx.arc(140, 90, 40, 0, 2 * Math.PI);
ctx.setStrokeStyle(colors[4]);
ctx.stroke();
ctx.draw();
}
})
//wxml
<canvas canvas-id="txw"></canvas>
第二题
//wxml
<view class="head">← 书单</view>
<view class="p1">
<view class="p2">培养商业意识,走出生活,职场和事业的困境</view>
<view class="p3">创新者是如何思考问题的?本书单包括了互联网,思维方式,商业,文案,市场,营销等方方面面,是在思维方式上的创新,略去传统商学院的教条</view>
</view>
<view class="shu">
<view class="imgone" style="display: flex;">
<image class="img1" src="/images/1.png"/>
<view class="textone">
<view class="text1">金字塔原理</view>
<view class="text2">芭芭拉•明托(Barbara Minto)</view>
<view class="text3">金字塔原理是一种重点突出、逻辑清晰、主次分明的逻辑思路、表达方式和规范动作……</view>
</view>
</view>
<view class="xian"></view>
<view class="imgtwo" style="display: flex;">
<image class="img2" src="/images/2.png"/>
<view class="texttwo">
<view class="text1">基业长青</view>
<view class="text2">[美]吉姆•柯林斯,杰里•波勒斯</view>
<view class="text3">《基业长青(珍藏版)》打破了旧有神话,提供了新颖的见解,并为那些有志于建立经得……</view>
</view>
</view>
</view>
//wxss
.head{
font-size: 60rpx;
margin-top: 200rpx;
}
.p1{
background-color: black;
}
.p2{
color: aliceblue;
text-align: center;
font-size: 45rpx;
padding: 30rpx;
}
.p3{
color: aliceblue;
padding: 20rpx;
}
.shu{
margin: 50rpx;
}
.textone{
margin-left: 50rpx;
}
.img1{
width: 700rpx;
height: 350rpx;
}
.img2{
width: 700rpx;
height: 350rpx;
}
.text1{
font-size: 70rpx;
font-weight: 700;
}
.text2{
font-size: 40rpx;
font-weight: 600;
}
.xian{
margin-top: 50rpx;
border-bottom: 4px solid #ccc;
}
.imgtwo{
margin-top: 50rpx;
}
.texttwo{
margin-left: 50rpx;
}
第三题
//wxml
<view>西安找拼车</view>
<view class="lxfs">联系方式(手机和微信至少填一项)</view>
<view style="border-bottom: 1px solid #ccc;"></view>
<view class="d1">
<view class="n1">称呼*</view>
<input type="text" placeholder="请输入称呼" style="margin-top: 12px;margin-left: 75px;"/>
</view>
<view class="d1">
<view class="n1">手机号</view>
<input type="password" placeholder="请输入手机号" style="margin-top: 12px;margin-left: 65px;"/>
</view>
<view style="display: flex; line-height: 50px;border-bottom: 1px solid #ccc;">
<view class="n1">微信号</view>
<input type="text" placeholder="请输入微信号" style="margin-top: 12px;margin-left: 65px;"/>
</view>
<view style="border-bottom: 1px solid #ccc;"></view>
<view class="pcxx">拼车信息</view>
<view class="d1">
<view class="n1">出发地点*</view>
<input type="text" placeholder="限7个字" style="margin-top: 12px;margin-left: 40px;"/>
</view>
<view class="d1">
<view class="n1">目的地*</view>
<input type="text" placeholder="限7个字" style="margin-top: 12px;margin-left: 55px;"/>
</view>
<view style="display: flex; line-height: 50px;">
<view style="font-size: 18px; font-weight: bold;margin-left:20px ;">空座数*</view>
<input type="text" placeholder="请输入空座数" style="margin-top: 12px;margin-left: 50px;"/>
</view>
<view style="border-bottom: 1px solid #ccc;"></view>
//wxss
.lxfs{
background-color: #F5F5F5;
line-height: 50px;
color: #B1AFB0;
border-bottom: 1px solid #ccc;
padding-left: 20px;
}
.d1{
display: flex;
line-height: 50px;
}
.pcxx{
background-color: #F5F5F5;
line-height: 50px;
color: #B1AFB0;
border-bottom: 1px solid #ccc;
padding-left: 20px;
}
.n1{
font-size: 17px;
font-weight: bold;
margin-left:20px
}
第四题
//wxml
<view style="text-align: center;">中国现阶段人均寿命900个月</view>
<form bindsubmit="bind" style="line-height: 60px;">
<view style="display: flex; font-size: 20px;">
<input class="p1" type="text" name="time" placeholder="请输入时间"/>至今{{people}}个月</view>
<view style="display: flex;">
<button class="b1" formType="submit">请输入后再点击此按钮</button>
<button class="b1" formType="reset" style="width: 150px;font-size: 13px;">清除记录</button>
</view>
</form>
<view style="margin-top:50px;"><image src="../../image/t6.jpg" class="t1" /></view>
<view style="width: 350px;"><text bindtap="changeText">{{text1}}</text></view>
//wxss
.p1{
width: 100px;
padding-top: 20px;
padding-left: 30px;
}
.b1{
font-weight: bold;
padding-right: 20px;
width: 175px;
font-size: 14px;
}
.t1{
width: 150px;
height: 300px;
margin-left: 100px;
}
//js
Page({
data:{
text1: '能把在前面行走的机会抓住的人,十有八九都会成功。',
people:new Date().toLocaleDateString()
},
changeText: function() {
this.setData({
text1: '成功了'
});
},
bind:function(e){
var time = new Date().toLocaleDateString()
var year = time.substring(0,time.indexOf("/"))
var mo = time.substring(time.indexOf("/")+1,time.lastIndexOf("/"))
var value = e.detail.value.time
var year2 = value.substring(0,time.indexOf("/"))
var mo2 = value.substring(time.indexOf("/")+1,time.lastIndexOf("/"))
var m1 = (year - year2 -1)*12+12-(mo2-mo)
}
})