first commit
This commit is contained in:
220
pages/home/home.js
Normal file
220
pages/home/home.js
Normal file
@@ -0,0 +1,220 @@
|
||||
//获取应用实例
|
||||
var app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据00
|
||||
*/
|
||||
data: {
|
||||
news: [],
|
||||
bannerdata: [
|
||||
"home-banner"
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
//生长曲线图
|
||||
go_grow() {
|
||||
if (wx.getStorageSync('phone') == '') {
|
||||
wx.setStorageSync('uidFlag', false);
|
||||
console.log('请登录')
|
||||
this.isdenglu()
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: '/pages/grocur/grocur',
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
//性发育图表
|
||||
go_peizhen() {
|
||||
if (wx.getStorageSync('phone') === '') {
|
||||
wx.setStorageSync('uidFlag', false);
|
||||
console.log('请登录');
|
||||
this.isDenglu();
|
||||
} else {
|
||||
wx.showToast({ title: '功能正在开发中', icon: 'none' });
|
||||
}
|
||||
},
|
||||
|
||||
//跳转性发育图表页面
|
||||
go_chart() {
|
||||
if (wx.getStorageSync('phone') == '') {
|
||||
wx.setStorageSync('uidFlag', false);
|
||||
console.log('请登录')
|
||||
this.isdenglu()
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: '/pages/sexChart/sexChart',
|
||||
});
|
||||
}
|
||||
},
|
||||
// 跳转身高SDS计算页面,并且携带一个类别参数
|
||||
// category为1时跳转身高SDS计算,category为2时跳转遗传靶身高
|
||||
redirectToHeightSDS() {
|
||||
wx.navigateTo({
|
||||
url: `/pages/heightSdsCalculator/heightSdsCalculator?category=1`,
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转遗传靶身高计算页面,并且携带类别参数category=2
|
||||
redirectToGeneticTargetHeight() {
|
||||
// wx.navigateTo({
|
||||
// url: `/pages/heightSdsCalculator/heightSdsCalculator?category=2`,
|
||||
// })
|
||||
wx.navigateTo({
|
||||
url: `/pages/tarhei/tarhei`,
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
//CPP预测计算
|
||||
go_cpp() {
|
||||
if (wx.getStorageSync('phone') == '') {
|
||||
wx.setStorageSync('uidFlag', false);
|
||||
console.log('请登录')
|
||||
this.isdenglu()
|
||||
} else {
|
||||
wx.switchTab({
|
||||
url: '/pages/tool/tool'
|
||||
});
|
||||
}
|
||||
},
|
||||
//IGF-1参考值
|
||||
go_peihu() {
|
||||
if (wx.getStorageSync('phone') == '') {
|
||||
wx.setStorageSync('uidFlag', false);
|
||||
console.log('请登录')
|
||||
this.isdenglu()
|
||||
} else {
|
||||
// wx.navigateTo({
|
||||
// url: "/pages/webpage/webpage?url=" + "https://mp.weixin.qq.com/s/Uz8Lh9ZSdPUPwupS06dh9Q" // 解码
|
||||
// });
|
||||
wx.navigateTo({
|
||||
url: "/pages/igfrefer/igfrefer",
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//获取资讯列表数据
|
||||
getOrderList: function () {
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: app.globalData.url + 'app/Ruilaiwechat/selectRealtimeInfoList',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data.pageNum,
|
||||
},
|
||||
success: (res) => {
|
||||
var resp = res.data;
|
||||
if (res.data.erro == 0) {
|
||||
if (res.data.currentPage == 1) {
|
||||
console.log("xxxe==" + res.data.currentPage)
|
||||
// 检查列表数量是否等于30
|
||||
if (this.data.news.length === 30){
|
||||
console.log("列表数量等于30")
|
||||
that.setData({
|
||||
news: resp.lists,
|
||||
pageNum: res.data.currentPage + 1
|
||||
});
|
||||
}else{
|
||||
that.setData({
|
||||
news: resp.lists,
|
||||
});
|
||||
}
|
||||
console.log("xxxe=pageNum=" + this.data.pageNum)
|
||||
} else {
|
||||
console.log("dddddddddd==")
|
||||
that.setData({
|
||||
news: this.data.news.concat(resp.lists),
|
||||
pageNum: res.data.currentPage + 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//是否登录
|
||||
isdenglu() {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '请先登录',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
wx.switchTab({
|
||||
url: '/pages/my/my'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
},
|
||||
|
||||
itemclick(e) {
|
||||
console.log("列表条目的index==" + e.currentTarget.dataset.index)
|
||||
console.log("列表条目的url==" + e.currentTarget.dataset.url)
|
||||
wx.navigateTo({
|
||||
url: "/pages/webpage/webpage?url=" + e.currentTarget.dataset.url // 解码
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.getOrderList()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
3
pages/home/home.json
Normal file
3
pages/home/home.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
88
pages/home/home.wxml
Normal file
88
pages/home/home.wxml
Normal file
@@ -0,0 +1,88 @@
|
||||
<view class="content">
|
||||
<view class="head-view">
|
||||
<!-- <image src="../image/home/home-head.png" mode="aspectFill"></image> -->
|
||||
</view>
|
||||
|
||||
<view class="home-title"><text>生长激素缺乏预测模型</text></view>
|
||||
<view class="banner">
|
||||
<swiper indicator-dots="true" autoplay="true" circular="true" interval="2000" duration="400" indicator-color="#fff" indicator-active-color="#FF9A16">
|
||||
<view wx:for="{{bannerdata}}" wx:key="id">
|
||||
<swiper-item>
|
||||
<image src="../image/home/home-banner.png" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</view>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<view class="name" style="margin-top: 30rpx;"><text>{{"生长发育相关参考计算和图表"}}</text></view>
|
||||
<view class="main" style="margin-top: 32rpx;">
|
||||
<!-- <view class="main-item" bindtap="go_peizhen">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/生长曲线图@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">生长曲线图</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="main-item" style="background-color: #EDFFFC;" bindtap="go_cpp">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/计算收藏@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">CPP预测计算</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-item" bindtap="go_peihu">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/IGF-1参考值@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">IGF-1参考值</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-item" bindtap="redirectToGeneticTargetHeight">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/遗传靶身高@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">遗传靶身高</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main" style="margin-top: 24rpx;">
|
||||
<view class="main-item" bindtap="go_peizhen">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/性发育图表@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">性发育图表</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-item" bindtap="redirectToHeightSDS">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/身高SDS计算@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view" >
|
||||
<text class="main-title">身高SDS计算</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-item" bindtap="go_grow">
|
||||
<image style="height: 86rpx;width: 86rpx;margin-left: 64rpx;margin-top: 40rpx;" src="../image/home/生长曲线图@2x.png" mode="aspectFit"></image>
|
||||
<view class="title-view">
|
||||
<text class="main-title">生长曲线图</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="news">
|
||||
<text class="news-title">最新资讯</text>
|
||||
<view wx:for="{{news}}" data-index="{{index}}" data-url="{{item.url}}" data-item="{{item}}" wx:for-item="item" bindtap="itemclick" class="flex-item">
|
||||
|
||||
<view class="news-item line">
|
||||
<view class="news-item-words">
|
||||
<view class="news-item-title"><text>{{item.title_plain}}</text></view>
|
||||
<view class="news-item-content"><text>{{item.excerpt_plain}}</text></view>
|
||||
</view>
|
||||
<view class="news-item-pic">
|
||||
<image mode="widthFix" src="{{item.thumbnail}}" class="news-item-image" width="" height=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="widgets__list widgets__list_show">
|
||||
<navigator url="/pages/news/news?cat={{cat}}" class="widget_more">
|
||||
<text class="news-more">查看更多</text>
|
||||
<image class="widget__arrow" src="/images/arrowright.png" mode="aspectFill" />
|
||||
<view class="widget__line widget__line_first"></view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
288
pages/home/home.wxss
Normal file
288
pages/home/home.wxss
Normal file
@@ -0,0 +1,288 @@
|
||||
.content{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
.head-view{
|
||||
width: 750rpx;
|
||||
height: 414rpx;
|
||||
background: linear-gradient( 139deg, #E1FFF4 0%, #F5F5F5 100%);
|
||||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.home-title{
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
font-size: 48rpx;
|
||||
color: #333333;
|
||||
margin: 108rpx 0 0 40rpx;
|
||||
}
|
||||
|
||||
.head-view image{
|
||||
width: 750rpx;
|
||||
height: 420rpx;
|
||||
}
|
||||
|
||||
.banner{
|
||||
position: relative;
|
||||
align-self: center;
|
||||
width: 670rpx;
|
||||
height: 286rpx;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner image{
|
||||
width: 670rpx;
|
||||
height: 286rpx;
|
||||
}
|
||||
|
||||
.item-view{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 30rpx 40rpx 0;
|
||||
}
|
||||
|
||||
#block{
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.item-list{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 10rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.main{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.main-item{
|
||||
background: #FFFFFF;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 214rpx;
|
||||
height: 214rpx;
|
||||
margin-left: 30rpx;
|
||||
border-radius: 24rpx 24rpx 24rpx 24rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.main-item image{
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
width: 375rpx;
|
||||
height: 254rpx;
|
||||
}
|
||||
|
||||
.title-view{
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
margin-left: 0rpx;
|
||||
margin-top: 150rpx;
|
||||
}
|
||||
|
||||
.title-image{
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main-title{
|
||||
width: auto;
|
||||
height: 26rpx;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
color: #000000;
|
||||
line-height: 26rpx;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.sub-title{
|
||||
margin-left: 64rpx;
|
||||
margin-top: 5rpx;
|
||||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
||||
font-size: 24rpx;
|
||||
color: #345170;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.list-item{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 30rpx 40rpx;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
display: flex;
|
||||
align-items: center; /* 这个属性确保所有子元素垂直居中 */
|
||||
padding: 10px; /* 添加一些内边距以便更好的视觉效果 */
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1; /* 让标题自动填充除图片外的所有可用空间 */
|
||||
margin-right: 10px; /* 如果需要,可以添加右边距以防标题和图片挤在一起 */
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
width: 80px; /* 设置图片宽度 */
|
||||
height: 80px; /* 设置图片高度为固定值或保持宽高比 */
|
||||
object-fit: cover; /* 确保图片不失真 */
|
||||
}
|
||||
|
||||
.list-item image{
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 90rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list-info{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 32rpx;
|
||||
}
|
||||
|
||||
.name{
|
||||
margin-left: 32rpx;
|
||||
margin-top: 0;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.list-lable{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.grade{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 32rpx;
|
||||
margin-top: 16rpx;
|
||||
width: 90rpx;
|
||||
height: 40rpx;
|
||||
background: -webkit-linear-gradient(left,#1F92FF,#1FC6FF);
|
||||
border-radius: 20rpx 20rpx 20rpx 0;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.genre{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 40rpx;
|
||||
margin-left: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
padding: 0 20rpx;
|
||||
background: -webkit-linear-gradient(left,#F4B616,#FF9A16);
|
||||
color: white;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.skiled{
|
||||
margin-left: 32rpx;
|
||||
margin-top: 24rpx;
|
||||
font-size: 30rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.address{
|
||||
margin-left: 32rpx;
|
||||
margin-top: 24rpx;
|
||||
font-size: 30rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.news {
|
||||
padding: 26rpx 0rpx 26rpx 32rpx;
|
||||
}
|
||||
.news-title {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.news-item {
|
||||
margin: 10rpx 0 10rpx 0;
|
||||
|
||||
background-color: #fff;
|
||||
}
|
||||
.news-item-pic {
|
||||
padding: 20rpx 0 10rpx 20rpx;
|
||||
width: 160rpx;
|
||||
|
||||
float: left;
|
||||
}
|
||||
.news-item-image {
|
||||
width: 100%;
|
||||
}
|
||||
.news-item-words {
|
||||
width: 450rpx;
|
||||
height: 65px;
|
||||
float: right;
|
||||
overflow-y: hidden;
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.news-item-title {
|
||||
font-size: 11pt;
|
||||
word-break: keep-all;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.news-item-content {
|
||||
font-size: 8pt;
|
||||
line-height: 13pt;
|
||||
text-overflow:ellipsis;
|
||||
color: #a9a9a9;
|
||||
}
|
||||
.news-more {
|
||||
color: #AAAAAA;
|
||||
font-size: 14px;
|
||||
|
||||
}
|
||||
.news-more-line {
|
||||
padding-left: -26rpx important;
|
||||
}
|
||||
.news-details-content {
|
||||
padding: 0 40rpx 100rpx 40rpx;
|
||||
}
|
||||
.video {
|
||||
|
||||
}
|
||||
.video-input {
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
.contact {
|
||||
padding: 40rpx 40rpx 40rpx 40rpx;
|
||||
}
|
||||
image {
|
||||
height: auto;
|
||||
}
|
||||
Reference in New Issue
Block a user