This commit is contained in:
2025-03-09 23:28:40 +08:00
parent cc44cf2067
commit ed1188098f
2 changed files with 114 additions and 154 deletions

View File

@@ -60,17 +60,6 @@ Page({
})
},
// goDoc(e){
// const staticDoc = {
// "aa": "https://xxxx.com/aa.html?type=bb"
// }
// let doc = e.currentTarget.dataset.doc;
// wx.navigateTo({
// url: "/pages/webview/index?url=" + encodeURIComponent(staticDoc[doc]) // 解码
// })
// }
bindDateChange: function (e) {
this.setData({

View File

@@ -1,5 +1,5 @@
//获取应用实例
var app = getApp();
const app = getApp()
Page({
/**
@@ -7,168 +7,146 @@ Page({
*/
data: {
news: [],
pageNum: 1,
bannerdata: [
"home-banner"
]
},
onShow() {
this.getOrderList()
},
// =============== 页面跳转相关 ===============
//生长曲线图
go_grow() {
if (wx.getStorageSync('phone') == '') {
wx.setStorageSync('uidFlag', false);
console.log('请登录')
this.isdenglu()
} else {
wx.navigateTo({
url: '/pages/grocur/grocur',
});
// 检查登录状态并跳转
checkLoginAndNavigate(path) {
if (!wx.getStorageSync('phone')) {
wx.setStorageSync('uidFlag', false)
this.showLoginModal()
return false
}
return true
},
//性发育图表
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() {
// 显示登录提示
showLoginModal() {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.switchTab({
url: '/pages/my/my'
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
// 生长曲线图
go_grow() {
if (this.checkLoginAndNavigate()) {
wx.navigateTo({
url: '/pages/grocur/grocur'
})
}
},
// 性发育图表
go_peizhen() {
if (this.checkLoginAndNavigate()) {
wx.showToast({
title: '功能正在开发中',
icon: 'none'
})
}
},
// 性发育图表页面
go_chart() {
if (this.checkLoginAndNavigate()) {
wx.navigateTo({
url: '/pages/sexChart/sexChart'
})
}
},
// 身高SDS计算页面
redirectToHeightSDS() {
wx.navigateTo({
url: '/pages/heightSdsCalculator/heightSdsCalculator?category=1'
})
},
// 遗传靶身高计算页面
redirectToGeneticTargetHeight() {
wx.navigateTo({
url: '/pages/tarhei/tarhei'
})
},
// CPP预测计算
go_cpp() {
if (this.checkLoginAndNavigate()) {
wx.switchTab({
url: '/pages/tool/tool'
})
}
},
// IGF-1参考值
go_peihu() {
if (this.checkLoginAndNavigate()) {
wx.navigateTo({
url: '/pages/igfrefer/igfrefer'
})
}
},
// =============== 资讯列表相关 ===============
// 获取资讯列表数据
getOrderList() {
wx.request({
url: app.globalData.url + 'app/Ruilaiwechat/selectRealtimeInfoList',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
page: this.data.pageNum
},
success: this.handleOrderListResponse.bind(this)
})
},
// 处理资讯列表响应
handleOrderListResponse(res) {
if (res.data.erro !== 0) return
const { lists, currentPage } = res.data
this.setData({
news: currentPage === 1 ? lists : this.data.news.concat(lists),
pageNum: currentPage + 1
})
},
// 资讯项点击
itemclick(e) {
const { url } = e.currentTarget.dataset
wx.navigateTo({
url: `/pages/webpage/webpage?url=${url}`
})
},
/**
* 生命周期函数--监听页面加载
*/
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 // 解码
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -176,13 +154,6 @@ redirectToGeneticTargetHeight() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getOrderList()
},
/**
* 生命周期函数--监听页面隐藏
*/