t
This commit is contained in:
@@ -14,7 +14,13 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
// 重置页码并重新获取数据
|
||||||
|
this.setData({
|
||||||
|
pageNum: 1,
|
||||||
|
news: []
|
||||||
|
}, () => {
|
||||||
this.getOrderList()
|
this.getOrderList()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// =============== 页面跳转相关 ===============
|
// =============== 页面跳转相关 ===============
|
||||||
@@ -123,14 +129,22 @@ Page({
|
|||||||
|
|
||||||
// 处理资讯列表响应
|
// 处理资讯列表响应
|
||||||
handleOrderListResponse(res) {
|
handleOrderListResponse(res) {
|
||||||
if (res.data.erro !== 0) return
|
if (res.data.erro !== 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '获取数据失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const { lists, currentPage } = res.data
|
const { lists, currentPage } = res.data
|
||||||
|
|
||||||
|
if (lists && lists.length > 0) {
|
||||||
this.setData({
|
this.setData({
|
||||||
news: currentPage === 1 ? lists : this.data.news.concat(lists),
|
news: currentPage === 1 ? lists : this.data.news.concat(lists),
|
||||||
pageNum: currentPage + 1
|
pageNum: currentPage + 1
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 资讯项点击
|
// 资讯项点击
|
||||||
@@ -172,14 +186,21 @@ Page({
|
|||||||
* 页面相关事件处理函数--监听用户下拉动作
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
|
// 下拉刷新时重置页码并重新获取数据
|
||||||
|
this.setData({
|
||||||
|
pageNum: 1,
|
||||||
|
news: []
|
||||||
|
}, () => {
|
||||||
|
this.getOrderList()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
// 上拉加载更多数据
|
||||||
|
this.getOrderList()
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {}
|
"usingComponents": {},
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"backgroundTextStyle": "dark"
|
||||||
}
|
}
|
||||||
@@ -1,166 +1,10 @@
|
|||||||
// pages/tool/tool.js
|
// pages/tool/tool.js
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
heightone: '',
|
// 表单数据
|
||||||
name: '诺言',
|
formData: {
|
||||||
age: '6',
|
|
||||||
height: '120',
|
|
||||||
boneAge: '6',
|
|
||||||
fatherHeight: '32',
|
|
||||||
motherHeight: '28',
|
|
||||||
igf: '334',
|
|
||||||
lh: '0.6',
|
|
||||||
thickness: '11',
|
|
||||||
result: '',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
inputName: function (e) {
|
|
||||||
this.setData({
|
|
||||||
name: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputAge: function (e) {
|
|
||||||
this.setData({
|
|
||||||
age: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputHeight: function (e) {
|
|
||||||
this.setData({
|
|
||||||
height: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputBoneAge: function (e) {
|
|
||||||
this.setData({
|
|
||||||
boneAge: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputFatherHeight: function (e) {
|
|
||||||
this.setData({
|
|
||||||
fatherHeight: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputMotherHeight: function (e) {
|
|
||||||
this.setData({
|
|
||||||
motherHeight: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputIGF: function (e) {
|
|
||||||
this.setData({
|
|
||||||
igf: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputLH: function (e) {
|
|
||||||
this.setData({
|
|
||||||
lh: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
inputThickness: function (e) {
|
|
||||||
this.setData({
|
|
||||||
thickness: e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
pintuan() {
|
|
||||||
this.setData({
|
|
||||||
show: true
|
|
||||||
});
|
|
||||||
},
|
|
||||||
tiaoguo() {
|
|
||||||
this.setData({
|
|
||||||
show: false
|
|
||||||
});
|
|
||||||
},
|
|
||||||
calculate: function () {
|
|
||||||
const data = this.data;
|
|
||||||
const result = {
|
|
||||||
};
|
|
||||||
console.log(result);
|
|
||||||
if (wx.getStorageSync('phone') == '') {
|
|
||||||
wx.setStorageSync('uidFlag', false);
|
|
||||||
console.log('请登录')
|
|
||||||
this.isdenglu()
|
|
||||||
} else {
|
|
||||||
this.setData({
|
|
||||||
show: true
|
|
||||||
});
|
|
||||||
this.payment()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//是否登录
|
|
||||||
isdenglu() {
|
|
||||||
wx.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '请先登录',
|
|
||||||
success(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
console.log('用户点击确定')
|
|
||||||
wx.switchTab({
|
|
||||||
url: '/pages/my/my'
|
|
||||||
})
|
|
||||||
} else if (res.cancel) {
|
|
||||||
console.log('用户点击取消')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
payment() {
|
|
||||||
if (this.data.name == '') {
|
|
||||||
wx.showToast({
|
|
||||||
title: '请输入姓名',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var that = this;
|
|
||||||
wx.request({
|
|
||||||
url: app.globalData.url + 'app/Ruilaiwechat/calculate',
|
|
||||||
data: {
|
|
||||||
uid: wx.getStorageSync('uid'), //人员id
|
|
||||||
name: this.data.name, //姓名
|
|
||||||
age: this.data.age, //年龄
|
|
||||||
height: this.data.height, //身高
|
|
||||||
bone_age: this.data.boneAge, //骨龄
|
|
||||||
father_height: this.data.fatherHeight, //父亲身高
|
|
||||||
mother_height: this.data.motherHeight, //母亲身高
|
|
||||||
IGF: this.data.igf, //IGF-1值
|
|
||||||
LH: this.data.lh, //LH基础值
|
|
||||||
uterus_thickness: this.data.thickness, //子宫厚度
|
|
||||||
},
|
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded'
|
|
||||||
},
|
|
||||||
success(res) {
|
|
||||||
if (res.data.erro == 0) {
|
|
||||||
that.setData({
|
|
||||||
result: res.data.calculate_resutlt,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
wx.showToast({
|
|
||||||
title: res.data.msg,
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad: function (options) {
|
|
||||||
},
|
|
||||||
|
|
||||||
go_history(){
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '/pages/order/order',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
if (wx.getStorageSync('phone') == '') {
|
|
||||||
wx.setStorageSync('uidFlag', false);
|
|
||||||
console.log('请登录')
|
|
||||||
this.isdenglu()
|
|
||||||
} else {
|
|
||||||
this.setData({
|
|
||||||
name: '',
|
name: '',
|
||||||
age: '',
|
age: '',
|
||||||
height: '',
|
height: '',
|
||||||
@@ -169,9 +13,149 @@ Page({
|
|||||||
motherHeight: '',
|
motherHeight: '',
|
||||||
igf: '',
|
igf: '',
|
||||||
lh: '',
|
lh: '',
|
||||||
thickness: '',
|
thickness: ''
|
||||||
});
|
},
|
||||||
console.log('order_id==')
|
// 计算结果
|
||||||
|
result: '',
|
||||||
|
// 结果弹窗显示状态
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
|
||||||
|
// =============== 表单输入处理 ===============
|
||||||
|
|
||||||
|
// 统一的输入处理函数
|
||||||
|
handleInput(e) {
|
||||||
|
const { field } = e.currentTarget.dataset
|
||||||
|
this.setData({
|
||||||
|
[`formData.${field}`]: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// =============== 登录检查 ===============
|
||||||
|
|
||||||
|
checkLogin() {
|
||||||
|
if (!wx.getStorageSync('phone')) {
|
||||||
|
wx.setStorageSync('uidFlag', false)
|
||||||
|
this.showLoginModal()
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
|
||||||
|
showLoginModal() {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '请先登录',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/my/my'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// =============== 计算相关 ===============
|
||||||
|
|
||||||
|
// 开始计算
|
||||||
|
calculate() {
|
||||||
|
if (!this.checkLogin()) return
|
||||||
|
|
||||||
|
if (!this.validateForm()) return
|
||||||
|
|
||||||
|
this.setData({ show: true })
|
||||||
|
this.submitCalculation()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 表单验证
|
||||||
|
validateForm() {
|
||||||
|
const { name } = this.data.formData
|
||||||
|
if (!name.trim()) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请输入姓名',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
|
||||||
|
// 提交计算请求
|
||||||
|
submitCalculation() {
|
||||||
|
const { formData } = this.data
|
||||||
|
|
||||||
|
wx.request({
|
||||||
|
url: app.globalData.url + 'app/Ruilaiwechat/calculate',
|
||||||
|
method: 'POST',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded'
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
uid: wx.getStorageSync('uid'),
|
||||||
|
name: formData.name,
|
||||||
|
age: formData.age,
|
||||||
|
height: formData.height,
|
||||||
|
bone_age: formData.boneAge,
|
||||||
|
father_height: formData.fatherHeight,
|
||||||
|
mother_height: formData.motherHeight,
|
||||||
|
IGF: formData.igf,
|
||||||
|
LH: formData.lh,
|
||||||
|
uterus_thickness: formData.thickness
|
||||||
|
},
|
||||||
|
success: this.handleCalculationResponse.bind(this)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理计算响应
|
||||||
|
handleCalculationResponse(res) {
|
||||||
|
if (res.data.erro === 0) {
|
||||||
|
this.setData({
|
||||||
|
result: res.data.calculate_resutlt
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
title: res.data.msg,
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// =============== 其他功能 ===============
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
reset() {
|
||||||
|
if (!this.checkLogin()) return
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
formData: {
|
||||||
|
name: '',
|
||||||
|
age: '',
|
||||||
|
height: '',
|
||||||
|
boneAge: '',
|
||||||
|
fatherHeight: '',
|
||||||
|
motherHeight: '',
|
||||||
|
igf: '',
|
||||||
|
lh: '',
|
||||||
|
thickness: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查看历史记录
|
||||||
|
go_history() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/order/order'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 弹窗控制
|
||||||
|
pintuan() {
|
||||||
|
this.setData({ show: true })
|
||||||
|
},
|
||||||
|
|
||||||
|
tiaoguo() {
|
||||||
|
this.setData({ show: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -22,39 +22,102 @@
|
|||||||
|
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">姓名:</text>
|
<text class="label">姓名:</text>
|
||||||
<input class="input" type="text" placeholder="请输入姓名" bindinput="inputName" value="{{name}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
data-field="name"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.name}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">年龄:</text>
|
<text class="label">年龄:</text>
|
||||||
<input class="input" type="digit" placeholder="请输入年龄" bindinput="inputAge" value="{{age}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入年龄"
|
||||||
|
data-field="age"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.age}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">身高(cm):</text>
|
<text class="label">身高(cm):</text>
|
||||||
<input class="input" type="digit" placeholder="请输入身高" bindinput="inputHeight" value="{{height}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入身高"
|
||||||
|
data-field="height"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.height}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">骨龄:</text>
|
<text class="label">骨龄:</text>
|
||||||
<input class="input" type="digit" placeholder="请输入骨龄" bindinput="inputBoneAge" value="{{boneAge}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入骨龄"
|
||||||
|
data-field="boneAge"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.boneAge}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">父亲身高(cm):</text>
|
<text class="label">父亲身高(cm):</text>
|
||||||
<input class="input" type="digit" placeholder="请输入父亲身高" bindinput="inputFatherHeight" value="{{fatherHeight}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入父亲身高"
|
||||||
|
data-field="fatherHeight"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.fatherHeight}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">母亲身高(cm):</text>
|
<text class="label">母亲身高(cm):</text>
|
||||||
<input class="input" type="digit" placeholder="请输入母亲身高" bindinput="inputMotherHeight" value="{{motherHeight}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入母亲身高"
|
||||||
|
data-field="motherHeight"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.motherHeight}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">IGF-1:(ng/ml)</text>
|
<text class="label">IGF-1:(ng/ml)</text>
|
||||||
<input class="input" type="digit" placeholder="请输入IGF基础值" bindinput="inputIGF" value="{{igf}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入IGF基础值"
|
||||||
|
data-field="igf"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.igf}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">LH基础(mIU/ml):</text>
|
<text class="label">LH基础(mIU/ml):</text>
|
||||||
<input class="input" type="digit" placeholder="请输入LH基础值" bindinput="inputLH" value="{{lh}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入LH基础值"
|
||||||
|
data-field="lh"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.lh}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
<text class="label">子宫厚度(mm):</text>
|
<text class="label">子宫厚度(mm):</text>
|
||||||
<input class="input" type="digit" placeholder="请输入厚度" bindinput="inputThickness" value="{{thickness}}" />
|
<input
|
||||||
|
class="input"
|
||||||
|
type="digit"
|
||||||
|
placeholder="请输入厚度"
|
||||||
|
data-field="thickness"
|
||||||
|
bindinput="handleInput"
|
||||||
|
value="{{formData.thickness}}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="addperson">
|
<view class="addperson">
|
||||||
|
|||||||
Reference in New Issue
Block a user