一、学习内容
- 了解电商项目基本需要的功能;
- 根据现有的美团外卖小程序,分析开发一个外卖的小程序需要开发哪一些功能;
- 开发一个仿美团外卖的小程序,完善好小程序的所有功能;
二、课后作业
(一)天气预报API
源码:
App.json
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#3333FF",
"navigationBarTitleText": "天气预报API",
"navigationBarTextStyle": "black",
"enablePullDownRefresh": true,
"backgroundColor": "#3300CC"
},
"tabBar": {
"color": "#666",
"selectedColor": "#00FFFF",
"list": [
{
"pagePath": "pages/index/index",
"text": "天气预报",
"iconPath": "assets/icons/weather.png",
"selectedIconPath": "assets/icons/acweather.png"
},
Index.wxml
<view class='nav'>
<image class='img' src='../../assets/icons/icon.png'></image>
<input class='ipt' placeholder-class='pla' placeholder='请输入城市名,快速查询天气信息' bindconfirm="finish" value='{ {value}}'></input>
</view>
<!-- ENDnav -->
<!-- user -->
<view class='user'>
<view class='userAvatar'>
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data class="userNick" type="userNickName"></open-data>
</view>
<!-- END user -->
<!-- location -->
<view class='map'>
<view class='l-box'>
<image class="img" src='../../assets/icons/location.png'></image>
<text class='loc'>{ {weather.city}}</text>
</view>
<text class='r-box'>{ {date}} { {weather.update_time}} 更新</text>
</view>
<!-- END location -->
<!-- weather -->
<view class='bg'>
<view class='info'>
<view class='tem'>
{ {weather.tem}} <text>℃</text>
</view>
<text class='wea'>{ {weather.wea}}</text>
<text class='air_level'>空气质量:{ {weather.air_level}}</text>
</view>
</view>
<!-- END weather -->
<!-- 7日天气 -->
<view class="weekday">7日天气</view>
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="scroll-view-item_H" wx:for="{ {weatherweek.data}}">
<view>{ {item.date}}</view>
<view>{ {item.tem2}}~{ {item.tem1}}</view>
<view class='wea'>{ {item.wea}}<image class='wea_img' src='../../weaicon/{ {item.wea_img}}.png'></image></view>
<view>{ {item.win[0]}}{ {item.win_speed}}</view>
</view>
</scroll-view>
<!-- 描述 -->
<view class="detail">
<view class="item">
<text>温度(℃)</text>
<text>{ {weather.tem}}</text>
</view>
<view class="item">
<text>湿度(%)</text>
<text>{ {humidity}}</text>
</view>
<view class="item">
<text>PM2.5</text>
<text>{ {weather.air_pm25}}</text>
</view>
<view class="item">
<text>气压(hPa)</text>
<text>{ {weather.pressure}}</text>
</view>
<view class="item">
<text>风向</text>
<text>{ {weather.win}}</text>
</view>
<view class="item">
<text>风速</text>
<text>{ {weather.win_meter}}</text></view>
<view class="item">
<text>风速等级</text>
<text>{ {weather.win_speed}}</text>
</view>
<view class=