//hospitalList.js 医院列表 联系医院
// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')
var app = getApp()
// 页码
var page = 0
// 地理位置信息
var latitude = 0
var longitude = 0
// 是否有更多
var hasMore = true
Page({
data: {
chooseOne: 0,
chooseTwo: 0,
chooseThree: 0,
content: "",
babyname:'',
babyid:''
},
onLoad: function (e) {
console.log('撒大大',e);
this.setData({
babyname:e.babyname,
babyid:e.babyid
})
wx.getSystemInfo({
success: function (res) {
console.log(res)
var system = res.system
var number = system.split(" ")[1]
console.log(system.split(" ")[1])
if (system.split(" ")[0] == "Android") {
if (number.split(".")[0] >= 6) {
console.log("beyond")
} else {
console.log("not beyond")
}
} else {
console.log("ios")
}
}
})
},
chooseOne: function () {
this.setData({
chooseOne: 1,
chooseTwo: 0,
chooseThree: 0,
})
},
chooseTwo: function () {
this.setData({
chooseOne: 0,
chooseTwo: 1,
chooseThree: 0,
})
},
chooseThree: function () {
this.setData({
chooseOne: 0,
chooseTwo: 0,
chooseThree: 1,
})
},
inputOver: function (e) {
var value = e.detail.value
this.setData({
content: value
})
},
submit: function () {
if (this.data.content.length==0){
networkUtil.showErrorToast('请填写意见或建议')
return
}
if (this.data.chooseOne == 0 && this.data.chooseTwo == 0 && this.data.chooseThree == 0 ){
networkUtil.showErrorToast('选择反馈类型')
return
}
let type
if(this.data.chooseOne==1){
type=1
}else if(this.data.chooseTwo==1){
type=2
}else{
type=3
}
let params={
content:this.data.content,
publishId:this.data.babyid,
publishName:this.data.babyname,
type:type,
hospitalId:app.globalData.userInfo.hospitalId
}
networkUtil._post(api.addfeedback, params, function (res) {
if(res.data.errorcode==0){
networkUtil.showErrorToast('提交成功')
console.log('res',res);
}
}, function (res) {
networkUtil.showErrorToast(res.errormsg)
},'application/json')
},
submit1:function(){
wx.navigateTo({
url: `/packageA/pages/feedbacklist/feedbacklist?id=${this.data.babyid}`
})
// networkUtil._get(api.getfeedback, {
// page:1,
// limit:10,
// babyId:this.data.babyid
// }, function(res) {
// }, function(res) {
// networkUtil.showErrorToast(res.errormsg)
// })
}
})