作者 lihongjuan

1

... ... @@ -2,7 +2,68 @@ App({
onLaunch: function() {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
this.autoUpdate()
},
autoUpdate:function(){
console.log(new Date())
var self=this
// 获取小程序更新机制兼容
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
//1. 检查小程序是否有新版本发布
updateManager.onCheckForUpdate(function (res) {
console.log('47454874',res)
// 请求完新版本信息的回调
if (res.hasUpdate) {
//2. 小程序有新版本,则静默下载新版本,做好更新准备
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
//3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
} else if (res.cancel) {
//如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了
wx.showModal({
title: '温馨提示~',
content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
success: function (res) {
self.autoUpdate()
//第二次提示后,强制更新
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
} else if (res.cancel) {
//重新回到版本更新提示
self.autoUpdate()
}
}
})
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
})
})
}
})
} else {
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
},
post: function(url, data) {
/**
* 自定义post函数,返回Promise
... ... @@ -36,6 +97,7 @@ App({
'content-type': 'application/x-www-form-urlencoded'
},
success: function(res) { //返回取得的数据
console.log('返回数据',res)
if (res.data.code == '1') {
resolve(res.data.data);
} else if (res.data.code == '20001') { //返回错误提示信息
... ... @@ -86,25 +148,37 @@ App({
} else if (res.data.code == '0') {
console.log(res)
console.log(888)
if (res.data.msg =='缺少必要参数:TOKEN'){
wx.showToast({
title: '请重新登陆',
icon: 'none'
})
wx.setStorageSync("token", '')
setTimeout(function(){
wx.navigateTo({
url: '/pages/index/index',
})
},1500)
}
// if (res.data.msg =='缺少必要参数:TOKEN'){
// wx.showToast({
// title: '请重新登陆',
// icon: 'none'
// })
// wx.setStorageSync("token", '')
// setTimeout(function(){
// wx.navigateTo({
// url: '/pages/index/index',
// })
// },1500)
// }
reject(res)
// reject(res)
}else if(res.data.code == '403'){
wx.showToast({
title:'登录过期,请重新登录',
icon:'none'
})
wx.removeStorageSync('token');
setTimeout(function(){
wx.reLaunch({
url:"/pages/index/index"
})
},1500)
} else {
reject(res)
}
... ...
{
"pages": [
"pages/homepage/homepage",
"pages/home/sellidel/sellidel",
"pages/home/stageofpregnancy/stageofpregnancy",
"pages/index/index",
"pages/home/searchpage/searchpage",
... ... @@ -23,7 +25,7 @@
"pages/home/used/used",
"pages/home/mypublish/mypublish",
"pages/home/sellidel/sellidel",
"pages/partneritem/afterchildbirthrecover/afterchildbirthrecover",
"pages/partneritem/afterchildbirth/afterchildbirth",
"pages/partneritem/sureorder/sureorder",
... ...
... ... @@ -114,7 +114,8 @@ Page({
star4:'',
explain_pic:[],
bigpic:'',
showpic:false
showpic:false,
scroll:true
... ... @@ -170,7 +171,7 @@ Page({
*/
onLoad: function(options) {
let that = this;
console.log(options)
console.log(options,'我是optionsoptions')
console.log(wx.getStorageSync('hospitalid'))
... ... @@ -179,8 +180,15 @@ Page({
hospital_address_id: options.hospital_address_id,
hostipalid:options.hospital_id
})
let token=wx.getStorageSync('token');
console.log('我是token我是token',token)
if(token==''){
wx.navigateTo({
url: '/pages/index/index?hospital_id='+this.data.hostipalid+'&status='+7+'&hospital_address_id='+this.data.hospital_address_id,
})
}
wx.getLocation({
type: 'gcj02',
... ... @@ -280,18 +288,11 @@ Page({
hospital_address_id: that.data.hospital_address_id
}
app.post(url, params).then((res) => {
console.log(999999999)
console.log(res)
console.log(that.data.buildlist)
if (res == "") {
that.setData({
buildlist: that.data.buildlist
})
} else {
if(res!=''){
let newbuildlist = res;
console.log(newbuildlist)
... ... @@ -325,6 +326,17 @@ Page({
console.log(that.data.buildlist)
}
// if (res == "") {
// that.setData({
// buildlist: that.data.buildlist
// })
// } else {
// }
... ... @@ -341,6 +353,9 @@ Page({
beioperaword(e) {
let that = this;
that.setData({
scroll:true
})
let archives_id = e.currentTarget.dataset.archives_id;
console.log(archives_id)
... ... @@ -491,40 +506,12 @@ Page({
}
app.post(url, params).then((res) => {
console.log(res)
that.setData({
homebuildlist: res
})
let newbuildlist = res;
// for (var i = 0; i <=newbuildlist.length; i++) {
// newbuildlist[i].showword = true
// if (newbuildlist[i].content_text.length > 80) {
// newbuildlist[i].openword = true
// newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
// } else {
// newbuildlist[i].openword = false
// }
// if (newbuildlist[i].content_imgs==null){
// newbuildlist[i].content_imgs=[]
// } else if (newbuildlist[i].content_imgs.length>3){
// newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
// }
// console.log(newbuildlist[i].content_imgs)
// // newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
// }
for (var i = 0; i < newbuildlist.length; i++) {
newbuildlist[i].showword = true
... ... @@ -552,18 +539,10 @@ Page({
}
that.setData({
homebuildlist: newbuildlist
})
console.log(that.data.homebuildlist)
}).catch((err) => {
})
... ... @@ -732,18 +711,19 @@ Page({
hospital_address_id: that.data.hospital_address_id
}
app.post(url, params).then((res) => {
console.log('8877665544332211',res)
// if (res == "") {
// that.setData({
// childbuildlist: that.data.childbuildlist
// })
if (res == "") {
that.setData({
childbuildlist: that.data.childbuildlist
})
return false;
} else {
that.setData({
childbuildlist: that.data.childbuildlist.concat(res)
})
}
// return false;
// } else {
// that.setData({
// childbuildlist: that.data.childbuildlist.concat(res)
// })
// }
// that.setData({
// buildlist:[]
... ... @@ -760,7 +740,7 @@ Page({
// }
let newbuildlist = that.data.childbuildlist;
let newbuildlist =res;
// for (var i = 0; i < newbuildlist.length; i++) {
// newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
... ... @@ -808,10 +788,14 @@ Page({
}
that.setData({
childbuildlist: newbuildlist
})
if(res.length!=0){
that.setData({
childbuildlist: that.data.childbuildlist.concat(newbuildlist)
})
}
// that.setData({
// childbuildlist: newbuildlist
// })
... ... @@ -824,7 +808,9 @@ Page({
//展开收起
fenoperaword(e) {
let that = this;
that.setData({
scroll:true
})
let childbirth_id = e.currentTarget.dataset.childbirth_id;
console.log(childbirth_id)
let showword = e.currentTarget.dataset.showword;
... ... @@ -2176,46 +2162,13 @@ getremaindoctorlist(){
num:2,
}
app.post(url, params).then((res) => {
console.log(res)
that.setData({
blendlist: res
})
// that.setData({
// buildlist:[]
// })
// console.log(res)
// if (res == '') {
// that.setData({
// buildlist: that.data.buildlist
// })
// } else {
// that.setData({
// buildlist: that.data.buildlist.concat(res)
// })
// }
let newbuildlist = that.data.blendlist;
// for (var i = 0; i < newbuildlist.length; i++) {
// newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
// newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
// if (newbuildlist[i].production_type == 1) {
// newbuildlist[i].production_type = '顺'
// } else if (newbuildlist[i].production_type == 2) {
// newbuildlist[i].production_type = '剖'
// }
// if (newbuildlist[i].sex == 1) {
// newbuildlist[i].sex = '男宝'
// } else if (newbuildlist[i].sex == 2) {
// newbuildlist[i].sex = '女宝'
// }
// }
for (var i = 0; i < newbuildlist.length; i++) {
newbuildlist[i].showword = true
... ... @@ -2236,22 +2189,16 @@ getremaindoctorlist(){
} else if (newbuildlist[i].production_type == 2) {
newbuildlist[i].production_type = '剖'
}
if (newbuildlist[i].sex == 1) {
newbuildlist[i].sex = '男宝'
} else if (newbuildlist[i].sex == 2) {
newbuildlist[i].sex = '女宝'
}
}
that.setData({
blendlist: newbuildlist
})
}).catch((err) => {
})
... ... @@ -2412,49 +2359,13 @@ getremaindoctorlist(){
token: wx.getStorageSync('token'),
hospital_id: that.data.hostipalid,
page: that.data.koubeipage,
num: 8,
num: 20,
status: that.data.hospitalstatus,
}
app.post(url, params).then((res) => {
console.log(res)
that.setData({
hospitalist: that.data.hospitalist.concat(res)
})
// that.setData({
// buildlist:[]
// })
// console.log(res)
// if (res == '') {
// that.setData({
// buildlist: that.data.buildlist
// })
// } else {
// that.setData({
// buildlist: that.data.buildlist.concat(res)
// })
// }
let newbuildlist = that.data.hospitalist;
// for (var i = 0; i < newbuildlist.length; i++) {
// newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
// newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
// if (newbuildlist[i].production_type == 1) {
// newbuildlist[i].production_type = '顺'
// } else if (newbuildlist[i].production_type == 2) {
// newbuildlist[i].production_type = '剖'
// }
// if (newbuildlist[i].sex == 1) {
// newbuildlist[i].sex = '男宝'
// } else if (newbuildlist[i].sex == 2) {
// newbuildlist[i].sex = '女宝'
// }
// }
console.log(res,'43834894389348943483483989')
let newbuildlist = res;
for (var i = 0; i < newbuildlist.length; i++) {
newbuildlist[i].showword = true
... ... @@ -2484,9 +2395,20 @@ getremaindoctorlist(){
}
that.setData({
hospitalist: newbuildlist
})
if(res.length!=0){
that.setData({
hospitalist: that.data.hospitalist.concat(newbuildlist)
})
}
console.log(99008877665544322115678900)
// that.setData({
// hospitalist: newbuildlist
// })
}).catch((err) => {
})
... ... @@ -2496,6 +2418,9 @@ getremaindoctorlist(){
//展开收起
kouoperaword(e) {
let that = this;
that.setData({
scroll:false
})
let customer_id = e.currentTarget.dataset.customer_id;
console.log(customer_id)
... ... @@ -2504,14 +2429,14 @@ getremaindoctorlist(){
if (showword == true) {
console.log(9090)
that.setData({
page: 1
page: 1,
})
var url = '/api/portal/hospital/getComment';
var params = {
token: wx.getStorageSync('token'),
hospital_id: that.data.hostipalid,
page: that.data.homeblendpage,
page: that.data.koubeipage,
num: 8,
status: that.data.hospitalstatus,
}
... ... @@ -2549,9 +2474,6 @@ getremaindoctorlist(){
if (obj.customer_id == customer_id) {
console.log(obj.archives_id)
console.log(obj.showword)
obj.showword = false;
obj.ccontent_text = obj.ccontent_text;
... ... @@ -2560,15 +2482,6 @@ getremaindoctorlist(){
} else if (obj.content_imgs.length>3){
obj.content_imgs = obj.content_imgs.slice(0, 3);
}
// if (obj.showword == false) {
// } else {
// obj.showword = true
// obj.content_text = obj.content_text.substring(0, 80);
// obj.content_imgs = obj.content_imgs.slice(0, 3);
// }
} else {
obj.content_text = obj.content_text.substring(0, 80);
if (obj.content_imgs == null) {
... ... @@ -2578,22 +2491,11 @@ getremaindoctorlist(){
}
}
}
that.setData({
hospitalist: newbuildlist
})
}).catch((err) => {
})
... ... @@ -2634,11 +2536,6 @@ getremaindoctorlist(){
}
// let newbuildlist=that.data.buildlist;
},
... ... @@ -3241,6 +3138,15 @@ getremaindoctorlist(){
that.getbuildlist();
},
onPageScroll (e) {
console.log(e)
this.setData({
scroll:true
})
console.log(this.data.scroll)
},
/**
* 生命周期函数--监听页面隐藏
... ... @@ -3267,37 +3173,67 @@ getremaindoctorlist(){
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
let that = this;
that.data.buildlistpage++;
that.getbuildlist();
that.data.childbirthpage++;
that.getchildinfo();
// that.data.hospitalpage++;
that.data.homeblendpage++;
that.gethospitallist();
if(that.data.scroll==true){
that.data.buildlistpage++;
that.getbuildlist();
that.data.childbirthpage++;
that.getchildinfo();
// that.data.hospitalpage++;
that.data.homeblendpage++;
that.gethospitallist();
let newdoctorpage = that.data.doctorpage;
newdoctorpage = newdoctorpage+1
that.setData({
doctorpage: newdoctorpage
})
console.log(that.data.doctorpage)
that.getremaindoctorlist()
}
let newdoctorpage = that.data.doctorpage;
newdoctorpage = newdoctorpage+1
that.setData({
doctorpage: newdoctorpage
})
console.log(that.data.doctorpage)
that.getremaindoctorlist()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
let that=this;
return {
title: that.data.hosname, // 转发后 所显示的title
// path: '/pages/home/buildtextdetail/buildtextdetail?buildid='+buildid+'&gettoken='+newtoken, // 相对的路径
path:'pages/home/hometail/hometail?hospital_id='+that.data.hostipalid+'&hospital_address_id='+that.data.hospital_address_id,//建档攻略分享1
// path:'',
success: (res)=>{ // 成功后要做的事情
console.log(res)
// console.log(res.shareTickets[0])
// console.log
// wx.getShareInfo({
// shareTicket: res.shareTickets[0],
// success: (res)=> {
// that.setData({
// isShow:true
// })
// console.log(that.setData.isShow)
// },
// fail: function (res) { console.log(res) },
// complete: function (res) { console.log(res) }
// })
},
fail: function (res) {
// 分享失败
console.log(res)
}
}
},
//口碑点评
publicpraise: function(e) {
... ...
... ... @@ -10,7 +10,9 @@ Page({
doctorid: '',
hospid: '',
activeid: '',
goodtail_id: ''
goodtail_id: '',
hospital_id:'',
hospital_address_id:''
},
... ... @@ -30,7 +32,12 @@ Page({
buildid: options.buildid,
})
}
if(options.hospital_id!=undefined){
this.setData({
hospital_id:options.hospital_id,
hospital_address_id:options.hospital_address_id
})
}
if (options.childrenid!=undefined){
this.setData({
childrenid: options.childrenid,
... ... @@ -122,7 +129,11 @@ Page({
wx.navigateTo({
url: "/pages/home/goodtail/goodtail_id?goodtail_id=" + goodtail_id,
})
}else{
}else if(that.data.status==7){
wx.navigateTo({
url: "/pages/home/hometail/hometail?hospital_id=" + that.data.hospital_id+'&hospital_address_id='+that.data.hospital_address_id,
})
} else{
wx.switchTab({
url: '/pages/homepage/homepage',
})
... ...
... ... @@ -39,6 +39,10 @@
"currentL": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": 5,
"list": [
... ... @@ -75,7 +79,28 @@
{
"id": -1,
"name": "我的订单",
"pathName": "pages/person/myOrder/myOrder"
"pathName": "pages/person/myOrder/myOrder",
"query": ""
},
{
"id": -1,
"name": "pages/homepage/homepage",
"pathName": "pages/homepage/homepage",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/homepage/homepage",
"pathName": "pages/homepage/homepage",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/homepage/homepage",
"pathName": "pages/homepage/homepage",
"scene": null
}
]
}
... ...