实训Day5

日期

2019年6月 17日

第 5 天  共 10天

实习地点

科技楼423

教学大纲中规定的实习教学内容

校内综合实训是系统讲授微信小程序开发技术,通过小程序开发项目实例来训练学生的实践能力,检验学生对微信小程序开发技术所学知识的综合运用能力的重要环节。每位学生需完成老师布置的实验内容,并完成综合性实训项目的开发。从而达到对所学知识的深刻理解,进而为今后更深入的学习和应用打下坚实的基础。

实习

目的及

要求

1、掌握微信小程序项目环境搭建;

2、掌握微信小程序项目界面设计编写;;

3、掌握微信小程序项目业务逻辑处理;

4、掌握MVVM设计模式框架开发;

5、通过本课程的学习,培养学生观察、分析、解决问题的能力;

6、培养学生严肃认真、实事求是的良好作风。

任务

完成

情况、

主要

收获

体会

 

 

实训第五天主要讲微信小程序项目组件应用相关知识,一开始老师先给我们讲解个人主页的样式如何实现,然后老师教我们如何使用接口来实现网络请求和响应,我们设置了相关了服务器的域名来请求需要的数据。

   在实现了网络请求和响应之后,我们还继续学会了通过数据绑定,将数据展示到页面上。

   在课余时间我们完成了老师布置的任务,做一个天气预报的小程序,在完成的过程中我遇到了不少的问题,比如样式的控制不够熟练等,我会在接下来的学习中不断去完善自己的不足。

 

 

教师

指导

(辅导)

内容

指导学生了解微信小程序项目组件应用,指导学生微信小程序项目组件应用实践

指导方式

面授

指导时长(分钟)

300

其它

需说

明的

情况

 

 

 

 

 

wxml
<image src="../../images/bg5.jpg" class="bg"></image>

<view class="container">
  
  <view class="nowWeather">
        <view class="city w">{{weather.city}}  麻章</view>
        <view class="temp w b">{{weather.data[0].tem}}</view>
        <view class="weather w">{{weather.data[0].wea}} | 空气 {{weather.data[0].air_level}}</view>
  </view>
  <view class="weahterDetail">
        <view class="">
          <view class="w center">{{weather.data[0].hours[0].win}}</view>
          <view wx:if="{{sc == '微风'}}" class="w b center f50">微风</view>
          <view wx:else class="w b center f50">{{weather.data[0].hours[0].win_speed}}</view>
        </view>
        <view class="l"></view>
        <view class="">
          <view class="w center">紫外线指数</view>
          <view class="w b center f50">{{weather.data[0].index[0].level}}</view>
        </view>
        <view class="l"></view>
        <view class="">
          <view class="w center">体感温度</view>
          <view class="w b center f50">{{weather.data[0].tem2}}</view>
        </view>
  </view>

</view>
 <view class='system'>
    <view></view>
    <view id="info"><text>未来一周天气</text></view> 
    <view><text class='colors'>{{weather.data[0].day}}:</text><text class='colors'>{{weather.data[0].wea}}</text></view>
    <view><text class='colors'>{{weather.data[1].day}}:</text><text class='colors'>{{weather.data[1].wea}}</text></view>
    <view><text class='colors'>{{weather.data[2].day}}:</text><text class='colors'>{{weather.data[2].wea}}</text></view>
    <view><text class='colors'>{{weather.data[3].day}}:</text><text class='colors'>{{weather.data[3].wea}}</text></view>
    <view><text class='colors'>{{weather.data[4].day}}:</text><text class='colors'>{{weather.data[4].wea}}</text></view>
    <view><text class='colors'>{{weather.data[5].day}}:</text><text class='colors'>{{weather.data[5].wea}}</text></view>
    <view><text class='colors'>{{weather.data[6].day}}:</text><text class='colors'>{{weather.data[6].wea}}</text></view>
  </view> 


js
//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    msg: "Home",
    id: "txt",
    yiyan:{},
    weather:{},
    // flag:false,
    index: "5",
    imgurl: [{
      url: "../../images/b3.jpg"
    }, {
      url: "../../images/b2.jpg"
    }, {
      url: "../../images/b1.jpg"
    }, {
      url: "../../images/b1.jpg"
    }, {
      url: "../../images/b2.jpg"
    }, {
      url: "../../images/b3.jpg"
    }, {
      url: "../../images/b1.jpg"
    }],
    // flag: false,
    obj: {
      name: "惠普",
      index: "0",
      time: "18"
    }
  },
  click: function () {
    var _this=this;
    wx.request({
      url: 'https://v1.hitokoto.cn',
      data: {
        x: '',
        y: ''
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        console.log(res.data);
        _this.setData({
          yiyan: res.data
        })
      }
    })
//天气天气
    wx.request({
      url: 'https://www.tianqiapi.com/api/',
      method:"get",
      dataType:"json",

      data: {
       version:"v1",
       city:'湛江',
       district:'麻章'
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        // console.log(res.data);
        console.log(res.data);
        _this.setData({
          weather: res.data
          // flag:true
        })
      }
    })
  },

  onLoad: function () {

    var _this = this;
    wx.request({
      url: 'https://v1.hitokoto.cn',
      //请求参数
      data: {
        x: '',
        y: '' 
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        console.log(res.data);
        _this.setData({
          yiyan: res.data
        })
      }
    })

    wx.request({
      url: 'https://www.tianqiapi.com/api/',
      method: "get",
      dataType: "json",

      data: {
        version: "v1",
        city: '湛江',
        district: '麻章'
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        // console.log(res.data);
        console.log(res.data);
        _this.setData({
          weather: res.data
          // flag:true
        })
      }
    })
  }
})

 

wxss
system{
  padding-left: 30rpx;
  width: 100%;
  
}
.system>view
{
  font-size: 30rpx;
  padding-right: 50rpx;
  height: 60rpx; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1rpx solid #ddd;
    font-weight: bold
  
}
#info{
  color: #666;
  font-size: 30rpx;
  align-items: center;
  padding-bottom: 5rpx;
  box-sizing: border-box;
  font-weight: bold;
}
.color{
  color: rgb(255, 255, 255);
}

.color{
  color: rgb(0, 0, 0)
}

.colortt{
  color: rgb(255, 255, 255);
  font-weight: bold;
}
.ml_10{
  margin-left: 10rpx;
}

/* 尝试 */
/**index.wxss**/
 
/**common css**/
.w{
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}
.b{
  font-weight: bold;
}
 
.l{
  border: 1rpx solid #fff;
}
 
.center{
  text-align: center;
  margin: auto 0;
}
 
.hor{
  display: flex;
}
 
.f50{
  font-size: 50rpx;
}
 
/**index css**/
 
 
.bg {
  width: 100%;
  height: 5q00rpx;
}
 
.box {
  flex-direction:column;
}

.temp{
  font-size: 100rpx;
}
 
.container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  height: 500rpx;
  display: block;
}
 
.nowWeather{
  padding: 60rpx;
}
 
.weahterDetail{
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  position: absolute;
  bottom: 50rpx;
  
}
 
.forcast{
  padding: 30rpx;
  margin-left: 16rpx;
  margin-right: 16rpx;
  border-bottom: 1rpx solid #eee;
  justify-content: space-around;
}
 
.img{
  width: 60rpx;
  height: 60rpx;
  margin-right: 
}

截图

 

 

 

 

 

 

以下是一个简单的C语言万年历的实训报告,供您参考: 一、实训目的 本次实训的主要目的是通过编写一个简单的C语言万年历程序,巩固C语言基本语法和编程思想,提高编程能力和解决问题的能力。 二、实训要求 1、能够使用C语言基本语法和控制语句编写程序。 2、能够使用数组来存储和操作数据。 3、能够使用函数来实现模块化编程。 4、能够使用指针来操作内存中的数据。 5、能够使用文件来读取和写入数据。 三、实训内容 1、程序功能 本程序实现了一个简单的万年历功能,可以通过输入年份和月份来显示该月的日历。 2、程序实现 以下是本程序的主要代码实现: ```c #include <stdio.h> // 判断是否为闰年 int is_leap_year(int year) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { return 1; } else { return 0; } } // 获取某个月份的总天数 int get_days(int year, int month) { int days[] = {31, 28 + is_leap_year(year), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; return days[month - 1]; } // 获取某个日期是星期几 int get_weekday(int year, int month, int day) { if (month == 1 || month == 2) { year--; month += 12; } int c = year / 100; int y = year % 100; int w = y + y / 4 + c / 4 - 2 * c + 26 * (month + 1) / 10 + day - 1; w = (w % 7 + 7) % 7; return w; } // 显示日历 void show_calendar(int year, int month) { int days = get_days(year, month); int weekday = get_weekday(year, month, 1); printf(" 日 一 二 三 四 五 六\n"); int i; for (i = 0; i < weekday; i++) { printf(" "); } for (i = 1; i <= days; i++) { printf("%2d ", i); if ((weekday + i) % 7 == 0) { printf("\n"); } } if ((weekday + days) % 7 != 0) { printf("\n"); } } int main() { int year, month; printf("请输入年份:"); scanf("%d", &year); printf("请输入月份:"); scanf("%d", &month); if (month < 1 || month > 12) { printf("月份输入错误!\n"); return 1; } printf(" %d年%d月\n", year, month); show_calendar(year, month); return 0; } ``` 四、实训总结 通过本次实训,我学会了如何使用C语言来编写一个简单的万年历程序,巩固了C语言基本语法和编程思想,加强了对函数、数组、指针、文件等概念和用法的理解,提高了编程能力和解决问题的能力。同时,我也意识到在编程过程中需要注重代码的规范、可读性和可维护性,这对于日后的开发工作非常重要。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值