与牧同行-小程序用户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

104 lines
2.0 KiB

import http from '../../../utils/api'
const baseUrl = require('../../../utils/baseUrl')
Page({
/**
* 页面的初始数据
*/
data: {
diagnosisData:{},
replies:[],
baseUrl:baseUrl,
refreshing: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (options.data) {
// 根据id加载兽医回复数据
const data = JSON.parse(decodeURIComponent(options.data));
if(data.images){
const images = data.images.split(',')
this.setData({
images:images
})
}
this.setData({
diagnosisData:data,
})
this.loadDiagnosisData(data.formId);
}
},
// 加载问诊数据
loadDiagnosisData(id) {
console.log('加载问诊数据:', id);
http.wzdxq({
data:{
consultationId:id
},
success:res=>{
console.log(111111111,res);
this.setData({
replies:res.rows
})
}
})
},
// 返回上一页
goBack() {
wx.navigateBack();
},
// 分享
onShare() {
wx.showActionSheet({
itemList: ['分享给好友', '保存到相册'],
success: (res) => {
if (res.tapIndex === 0) {
wx.showToast({
title: '已分享',
icon: 'success'
});
}
}
});
},
// 下拉刷新
onRefresh() {
this.setData({
refreshing: true
});
this.loadDiagnosisData(this.data.diagnosisData.formId)
setTimeout(() => {
this.setData({
refreshing: false
});
wx.showToast({
title: '刷新成功',
icon: 'success'
});
}, 1000);
},
// 预览图片
previewImage(e) {
const current = e.currentTarget.dataset.url;
const urls = e.currentTarget.dataset.urls;
const urlsArray = urls.map(item=>{
return baseUrl+item
})
console.log(666,urlsArray);
wx.previewImage({
current:current,
urls:urlsArray
});
},
});