parent
48a110907e
commit
928ab131a8
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,76 @@
|
||||
const app = getApp();
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
base_url: "https://www.educoder.net",
|
||||
page_info: {},
|
||||
page_status: 0
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
app.client.get_home_page()
|
||||
.then(res=>{
|
||||
console.info(res);
|
||||
this.setData({page_info: res.data, page_status: 1});
|
||||
}).catch(error=>{
|
||||
this.setData({page_status: 2});
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<view class="container">
|
||||
<view class="swiper-images">
|
||||
<swiper class="swiper-images" indicator-dots="1" autoplay="1">
|
||||
<swiper-item class="swiper-image" wx:for="{{page_info.images_url}}" wx:for-item="image">
|
||||
<image class="swiper-image" mode="widthFix" src="{{base_url+image.image_url}}"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<view class="subjects">
|
||||
<view class="title">
|
||||
<text>实训课程</text>
|
||||
<text class="hint">TRAINING COURSE</text>
|
||||
</view>
|
||||
<view class="loading">
|
||||
<!---->
|
||||
</view>
|
||||
<view class="grid-view">
|
||||
<view class="grid-item" wx:for="{{page_info.subjects}}" wx:for-item="subject">
|
||||
<view class="item">
|
||||
<image src="{{base_url+'/'+subject.image_url}}" mode="widthFix"></image>
|
||||
<view class="detail">
|
||||
<text class="name">{{subject.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pratices">
|
||||
<view class="title">
|
||||
<text>实训课程</text>
|
||||
<text class="hint">DEVELOPMENT COMMUNITY</text>
|
||||
</view>
|
||||
<view class="loading" wx:if="{{page_status==0}}">
|
||||
<!---->
|
||||
</view>
|
||||
<view class="grid-view">
|
||||
<view class="grid-item" wx:for="{{page_info.shixuns}}" wx:for-item="practice">
|
||||
<view class="item">
|
||||
<image src="{{base_url+'/'+practice.pic}}" mode="widthFix"></image>
|
||||
<view class="detail">
|
||||
<text class="name">{{practice.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,65 @@
|
||||
view.swiper-images{
|
||||
margin: 0 -12px;
|
||||
}
|
||||
swiper.swiper-images{
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
image.swiper-image{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title{
|
||||
margin-top: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title .hint{
|
||||
font-size: 8px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.subjects{
|
||||
margin: 0 -8px;
|
||||
}
|
||||
|
||||
.grid-view{
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-item{
|
||||
flex: 0 0 auto;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.item{
|
||||
overflow: hidden;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 1px 1px 8px #909090;
|
||||
margin: 12rpx 10rpx 16rpx 10rpx;
|
||||
}
|
||||
.item:hover{
|
||||
box-shadow: 2px 2px 14px #707070;
|
||||
margin: 8rpx 10rpx 20rpx 10rpx;
|
||||
}
|
||||
.item image{
|
||||
width: 100%;
|
||||
}
|
||||
.item .detail{
|
||||
padding: 2rpx 16rpx 14rpx 16rpx;
|
||||
}
|
||||
|
||||
text.name{
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
font-size: 10px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/**动画*/
|
@ -0,0 +1,3 @@
|
||||
/**
|
||||
* analyse url path to get info in order to navigate to the right page
|
||||
*/
|
Loading…
Reference in new issue