admin管理员组

文章数量:1573363

操作题

设置样式

Page({
  onReady: function () {
    const ctx = wx.createCanvasContext('olympic-rings');
 
    // 设五环颜色
    const colors = ['#6495ed', '#000000', '#9acd32', '#ff0000', '#ffd700'];
 
    // 绘制蓝色环
    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();
  }
});
<canvas canvas-id="olympic-rings" style="width: 800px; height: 500px;"></canvas>
<!-- 引用canvas组件并设置id -->

结果

2,使用组件完成书单

<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="/pages/test/tu1.png"/>
    <view class="textone">
      <view class="text1">昆虫记</view>
      <view class="text2">卡西米尔·法布尔</view>
      <view class="text3">《昆虫记》是一本讲昆虫生活的书,涉及蜣螂、蚂蚁、西绪福斯虫等100多种昆虫......</view>
    </view>
  
.head{
  font-size: 60rpx;
}
.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;
}

结果

3,弄好西安找拼车小程序

<view class="head">✕ 西安找拼车</view>
<view class="one">
  <view class="dwj"></view>
</view>
<view class="two">
  <view class="two2">称呼*</view>
  <view class="two3">请输入称呼</view>
</view>
<view class="three">
  <view class="three2">手机号</view>
  <view class="three3">请输入手机号</view>
</view>
<view class="four">
  <view class="four2">微信号</view>
  <view class="four3">请输入微信号</view>
</view>
<view class="one">
  <view class="dwj">拼车信息</view>
</view>
<view class="five">
  <view class="five2">出发地点*</view>
  <view class="five3">限7个字</view>
</view>
<view class="six">
  <view class="six2">目的地*</view>
  <view class="six3">限7个字</view>
</view>
<view class="seven">
  <view class="seven2">空座数*</view>
  <view class="seven3">请输入空座数</view>
</view>
.head{
  font-size: 70rpx;
  color: aliceblue;
  background-color: black;
}
.one{
  padding: 45rpx 0 0 40rpx;
  border-bottom: 4px solid #c0c0c0; 
  background-color: #ccc;
}
.dwj{
  width: auto;
  height: 100rpx;
  font-size: 35rpx;
}
.two{
  margin-left: 30px;
  padding: 20px 0 20px 0;
  border-bottom: 4px solid #c0c0c0;
}
.two2{
  font-size: 55rpx;
  font-weight: 700;
}
.two3{
  position: absolute;
  left: 180px;
  top: 217px;
  font-size: 55rpx;
}
.three{
  margin-left: 30px;
  padding: 20px 0 20px 0;
  border-bottom: 4px solid #c0c0c0;
}
.three2{
  font-size: 55rpx;
  font-weight: 700;
}
.three3{
  position: absolute;
  left: 180px;
  top: 300px;
  font-size: 55rpx;
}
.four{
  padding: 20px 0 20px 30px;
  border-bottom: 4px solid #c0c0c0;
}
.four2{
  font-size: 55rpx;
  font-weight: 700;
}
.four3{
  position: absolute;
  left: 180px;
  top: 385px;
  font-size: 55rpx;
}
.five{
  margin-left: 30px;
  padding: 20px 0 20px 0px;
  border-bottom: 4px solid #c0c0c0;
}
.five2{
  font-size: 55rpx;
  font-weight: 700;
}
.five3{
  position: absolute;
  left: 180px;
  top: 555px;
  font-size: 55rpx;
}
.six{
  margin-left: 30px;
  padding: 20px 0 20px 0px;
  border-bottom: 4px solid #c0c0c0;
}
.six2{
  font-size: 55rpx;
  font-weight: 700;
}
.six3{
  position: absolute;
  left: 180px;
  top: 640px;
  font-size: 55rpx;
}
.seven{
  padding: 20px 0 20px 30px;
  border-bottom: 4px solid #c0c0c0;
}
.seven2{
  font-size: 55rpx;
  font-weight: 700;
}
.seven3{
  position: absolute;
  left: 180px;
  top: 725px;
  font-size: 55rpx;
}

结果

编程题目

请编写“人生进程”是一款极简的小程序它有一个功能就是计算一个人从出生到现在已经度过了多少个月

{
  "pages": [
    "pages/index/index",
    "pages/yy/yy",
    "pages/ww/ww",
    "pages/qq/qq"
  ],
  "window": {
    "backgroundColor": "#F6F6F6",
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#F6F6F6",
    "navigationBarTextStyle": "black"
  },
  "tabBar": {
    "color": "#666666",
    "selectedColor": "#ff0000",
    "borderStyle":"black",
    "backgroundColor": "#ffffff",
    "list": [{
      "pagePath": "pages/index/index",
      "iconPath": "./pages/images/mao.png",
      "selectedIconPath": "./pages/images/mao.png",
      "text": "开头"
    },
    {
      "pagePath": "pages/yy/yy",
      "iconPath": "./pages/images/mao.png",
      "selectedIconPath": "./pages/images/mao.png",
      "text": "年月日"
    },
    {
      "pagePath": "pages/ww/ww",
      "iconPath": "./pages/images/mao.png",
      "selectedIconPath": "./pages/images/mao.png",
      "text": "看就看"
    },
    {
      "pagePath": "pages/qq/qq",
      "iconPath": "./pages/images/mao.png",
      "selectedIconPath": "./pages/images/mao.png",
      "text": "环境"
    }]
  },
  "style": "v2",
  "componentFramework": "glass-easel",
  "lazyCodeLoading": "requiredComponents"
}
{
  "navigationBarBackgroundColor": "#000000",
  "navigationBarTitleText": 护法tg
  "navigationBarTextStyle": "red",
  "backgroundTextStyle": "dark"
}
Page({
 
})
 
 .tou{
  float: left;
  margin-top: 8px;
  width: 450px; 
  height: 220px;
}
.tu1{
  margin: 0 auto;
  float: left;
  display: block;
  width: 180px; 
  height: 160px;
}
.yi{
  margin-top: 10px;
}
.ig1{
  margin-top: 5px;
}
.ig2 {
  position: absolute; 
 
}
.ig2 image{
  position: relative;
  top: 274px;
  left: 2px;
}
 
.ig3{
  margin-top: 5px;
  position: absolute;
}
.ig3 image{
  position: relative;
  top: 390px;
}
.yi{
  margin-top: 5px;
  float: right;
}
.er{
  margin-top: 5px;
  float: right;
}
.tu2{
  margin: 0 auto;
  float: left;
  display: block;
  width: 180px; 
  height: 160px;
  margin-top: 60px;
}
.zi1{
  margin: 0 auto;
  display: block;
  font-size: 30px;
  float: none;
  display: block;
  margin-left: 200px;
  margin-top: 10px; 
}
.zi2{
  display: block;
  font-size: 15px;
 float: none;
  display: block;
  margin-left: 200px;
  margin-top: 10px;
}
.zi3{
  display: block;
  font-size: 10px;
  float: right;
  display: block;
  margin-left: 200px;
  margin-top: 10px;
}
<view style="text-align: center;">中国现阶段人均寿命900个月</view>
<form bindsubmit="bind" style="line-height: 60px;">
<view style="display: flex; font-size: 30px;">
<input type="text" name="time" placeholder="请输入时间" class="mm"/>至今:{{people}}个月</view>
<view style="display: flex;">
<button formType="submit" class="bt">请输入后再点击此按钮</button>
<button formType="reset" style="width: 150px;font-size: 13px;">清除记录</button>
</view>
</form>
<view style="margin-top:50px;">
<image src="../images/hong.jpg" class="r" style="width: 250px;" />
</view>
<view style="width: 350px;">
  <text bindtap="changeText1">{{ text1 }}</text>
</view>
Page({
     data:{  
      text1: '点击',
          people:new Date().toLocaleDateString()
    
        },
      changeText1: 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)
          this.setData({
            people : m1
          })
        }
  })
.mm{
  width: 110px;
  padding-top: 18px;
  padding-left: 30px;
}
.bt{
  padding-right: 20px;
  width: 175px;
  font-size: 13px;
  font-weight: bold;
}
.r{
  width: 190px;
  height: 350px;
  margin-left: 80px;
 
}

结果

本文标签: 作业第四章