6.21提交

This commit is contained in:
zoujiandong 2025-06-21 17:43:26 +08:00
parent ce9158a8a0
commit 8f4ee464dc
7 changed files with 990 additions and 844 deletions

View File

@ -5,12 +5,13 @@ function addCase(data){ //添加病例
function caseDetail(id){ //病例详情
return request('/medicalRecord/getDetail/'+id,'GET',{},true)
};
function editCase(data){ //修改病例
return request('/medicalRecord/update','POST',data,true)
};
function caseList(data){ //病例列表
return request('/medicalRecord/getList','POST',data,true)
};
function editCase(data){ //修改病例
return request('/medicalRecord/update','POST',data,true)
};
function getCaptcha(){ //获取图片验证码
return request('/user/getCaptcha','GET')
};

View File

@ -18,6 +18,10 @@ Page({
ganwaiOption:ganwaiOption,
moshiOption:moshiOption,
hospitalOption:hospitalOption,
editorHeight:'calc(100vh - 600rpx)',
paintFrom:'basic',
paintSrc:'',
showPaint:false,
active:0,
wordLength:0,
showSaveBtn:true,
@ -35,7 +39,6 @@ Page({
showDel:false,
showAttention:false,
fileList_basic:[],
fileList_abstract:[],
fileList_check:[],
dpmas_list:[{fileList:[],treatTime:''}],
disable_ziliao:false,
@ -73,36 +76,52 @@ Page({
otherValue:''
},
},
disease_desc:'',
disease_history:'',
past_history:'',//临床资料结束
abstract_str:'',//临床资料结束
dpmas:[{
'dpmasImg':'',
'treatTime':''
}],
headTime:'',
afterTime:'',
lastTime:'',
headTb:'',
afterTb:'',
headAlt:'',
afterAlt:'',
headAlb:'',
afterAlb:'',
headAst:'',
afterAst:'',
headInr:'',
afterInr:'',
lastTb:'',
headDb:'',
afterDb:'',
lastDb:'',
headIb:'',
afterIb:'',
lastIb:'',
headAlt:'',
afterAlt:'',
lastALt:'',
headAst:'',
afterAst:'',
lastAst:'',
headAlb:'',
afterAlb:'',
lastAlb:'',
headPta:'',
afterPta:'',
lastPta:'',
headInr:'',
afterInr:'',
lastInr:'',
headCrp:'',
afterCrp:'',
lastCrp:'',
headIl6:'',
afterIl6:'',
lastIl6:'',
headTnf:'',
afterTnf:'',
checkImg:''
lastTnf:'',
checkImg:'',
discharge_time:'',
day:'',
discharge_situation:'',
discharge_status:''
},
time_type:'date',
time_str:"hospitalTime",
@ -131,6 +150,17 @@ Page({
},
},
onEditorReady() {
const that = this
wx.createSelectorQuery().select('#editor').context(function (res) {
that.editorCtx = res.context;
let html =
"<p>【主诉】:</p><br/><p>【现病史】:</p><br/><p>【既往史】:</p><br/><br/>";
that.editorCtx.setContents({
html:html
})
}).exec()
},
onChangeCheck(event){
console.log(event);
let arr=event.detail;
@ -161,9 +191,6 @@ Page({
toggleCheck(event){
console.log(event);
},
dealImg(e){
console.log(e);
},
save:throttle(function(){
this.data.medicalRecordId?this.handleEditCase():this.handleAddCase();
}),
@ -205,20 +232,20 @@ Page({
}),
isHasValue(){
let {name,uid,sex,age,admissionTime,caseType,main_diagnose,disease_cause,trigger,disease_desc,disease_history,past_history,headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headAlb,afterAlb,headAst,afterAst,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf}=this.data.case;
let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data;
let {name,uid,sex,age,admissionTime,caseType,main_diagnose,disease_cause,trigger,abstract_str,headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headAlb,afterAlb,headAst,afterAst,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf}=this.data.case;
let {fileList_basic,fileList_check,dpmas_list,discharge_time,day,discharge_status,discharge_situation}=this.data;
let hasTime=dpmas_list.some(item=>{ return item.fileList.length>0});
let hasImg=dpmas_list.some(item=>{ return item.treatTime!=''});
if(name || uid || sex || age || admissionTime || caseType.length>0 || main_diagnose.select.length>0 || main_diagnose.otherValue || disease_cause.select.length>0 || disease_cause.otherValue || trigger.inside.select.length>0 || trigger.inside.otherValue || trigger.outside.select.length>0 || trigger.outside.otherValue || disease_desc || disease_history ||past_history || headTime || afterTime || headTb || afterTb || headAlt || afterAlt || headAlb || afterAlb || headAst || afterAst || headInr || afterInr || headDb || afterDb || headIb || afterIb || headPta || afterPta || headIl6 || afterIl6 || headTnf || afterTnf || fileList_basic.length>0 || fileList_abstract.length>0 || fileList_check.length>0 || hasTime || hasImg){
if(name || uid || sex || age || admissionTime || caseType.length>0 || main_diagnose.select.length>0 || main_diagnose.otherValue || disease_cause.select.length>0 || disease_cause.otherValue || trigger.inside.select.length>0 || trigger.inside.otherValue || trigger.outside.select.length>0 || trigger.outside.otherValue || abstract_str || headTime || afterTime || headTb || afterTb || headAlt || afterAlt || headAlb || afterAlb || headAst || afterAst || headInr || afterInr || headDb || afterDb || headIb || afterIb || headPta || afterPta || headIl6 || afterIl6 || headTnf || afterTnf || fileList_basic.length>0 || fileList_check.length>0 || hasTime || hasImg || discharge_time || day|| discharge_status ||discharge_situation){
return true
}else{
return false
}
},
handleAddCase(){
let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data;
let {fileList_basic,fileList_check,dpmas_list}=this.data;
let baseImg='';
let abstractImg='';
let checkImg='';
@ -230,13 +257,7 @@ Page({
baseImg+=item.url;
}
})
fileList_abstract.forEach(item=>{
if(abstractImg){
abstractImg+="," +item.url
}else{
abstractImg+=item.url;
}
})
fileList_check.forEach(item=>{
if(checkImg){
checkImg+="," +item.url
@ -366,16 +387,6 @@ Page({
})
}
}else if(key=='abstractImg'){
if(res[key]){
let imgList=res[key].split(',');
this.setData({
['case.'+key]:res[key],
fileList_abstract:imgList.map(item=>{
return {url:item}
})
})
}
}else if(key=='checkImg'){
if(res[key]){
let imgList=res[key].split(',');
@ -572,7 +583,20 @@ Page({
})
return false
}
if(main_diagnose.select.length==0){
flag && wx.showToast({
title: '请选择主要诊断类型',
icon:"none"
})
return false
}
if(main_diagnose.select.length==0 && !main_diagnose.otherValue){
flag && wx.showToast({
title: '主要诊断其他不能为空',
icon:"none"
})
return false
}
if(fileList_basic.length==0){
flag && wx.showToast({
title: '请上传出院诊断照片',
@ -625,28 +649,15 @@ Page({
return true
},
validateZiliao(flag){
let {disease_desc,disease_history,past_history}=this.data.case;
if( !disease_desc){
let {abstract_str}=this.data.case;
if( !abstract_str){
flag && wx.showToast({
title: '病历摘要主诉不能为空',
title: '病历摘要不能为空',
icon:"none"
})
return false
}
if( !disease_history){
flag && wx.showToast({
title: '病历摘要现病史不能为空',
icon:"none"
})
return false
}
if( !past_history){
flag && wx.showToast({
title: '病历摘要现病史不能为空',
icon:"none"
})
return false
return false
}
return true
},
validateRecord(flag){
@ -710,131 +721,178 @@ Page({
return true
},
validateCheck(flag){
let {headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf,caseType,admissionTime,dpmas }=this.data.case;
let {headTime,afterTime,lastTime,headTb,afterTb,lastTb,headAlt,afterAlt,lastAlt,headAst,afterAst,lastAst,headInr,afterInr,lastInr,headAlb,afterAlb,lastAlb,caseType,admissionTime,dpmas}=this.data.case;
let {fileList_check}=this.data;
if(!headTime){
if(!headTime){
flag && wx.showToast({
title: '治疗前检测时间不能为空',
title: '首次治疗前检测时间不能为空',
icon:"none"
})
return false
};
if(!afterTime){
flag && wx.showToast({
title: '治疗后检测时间不能为空',
title: '首次治疗后检测时间不能为空',
icon:"none"
})
return false
};
if(!lastTime){
flag && wx.showToast({
title: '最后一次治疗后检测时间不能为空',
icon:"none"
})
return false
};
let headTime_new=dayjs(headTime).format('YYYY-MM-DD');
let afterTime_new=dayjs(afterTime).format('YYYY-MM-DD');
let firstTime=dayjs(dpmas[0].treatTime).format('YYYY-MM-DD');
let lastTime_new=dayjs(lastTime).format('YYYY-MM-DD');
let firstTime=dayjs(dpmas[0].treatTime).format('YYYY-MM-DD');//第一次治疗时间
let lastTime=dayjs(dpmas[dpmas.length-1].treatTime).format('YYYY-MM-DD')
let admissionTime_new=dayjs(admissionTime).format('YYYY-MM-DD');
if(caseType==2){
if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){
flag && wx.showToast({
title: '治疗前检测时间应该在入院时间与第一次治疗时间之间',
icon:"none"
})
return false
}
if(dpmas.length<2){
if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0)){
flag && wx.showToast({
title: '治疗后检测时间应该在第一次之后',
icon:"none"
})
return false
}
}else{
let secondTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD')
if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0 && dayjs(afterTime_new).diff(dayjs(secondTime))<=0)){
flag && wx.showToast({
title: '治疗后检测时间应该在第一次与第二次治疗时间之间',
icon:"none"
})
return false
};
}
};
if(caseType==1){
if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){
flag && wx.showToast({
title: '治疗前检测时间应该在入院时间与第一次治疗时间之间',
icon:"none"
})
return false
}
if(!(dayjs(afterTime_new).diff(dayjs(lastTime)>=0))){
flag && wx.showToast({
title: '治疗后检测时间应该最后一次治疗时间之后',
icon:"none"
})
return false
}
}
if(!headTb || !afterTb){
let lastTreatTime=dayjs(dpmas[dpmas.length-1].treatTime).format('YYYY-MM-DD')//最后一次治疗时间
let admissionTime_new=dayjs(admissionTime).format('YYYY-MM-DD'); //住院时间
//新加判断
if(dayjs(headTime_new).diff(dayjs(afterTime_new))>=0){
flag && wx.showToast({
title: '总胆红素未填写完整',
icon:"none"
})
return false
};
if(!headAlt || !afterAlt){
title: '首次治疗时间前检测时间应该早于首次治疗后检测时间',
icon:'none'
})
return false;
}
if(dayjs(afterTime_new).diff(dayjs(lastTime_new))>0){
flag && wx.showToast({
title: '谷丙转氨酶未填写完整',
icon:"none"
})
return false
};
if(!headInr || !afterInr){
flag && wx.showToast({
title: '国际标准化比值未填写完整',
icon:"none"
})
return false
}
// if(!headDb || !afterDb){
// flag && wx.showToast({
// title: '直接胆红素未填写完整',
// icon:"none"
// })
// return false
// }
// if(!headIb || !afterIb){
// flag && wx.showToast({
// title: '间接胆红素未填写完整',
// icon:"none"
// })
// return false
// }
// if(!headPta || !afterPta){
// flag && wx.showToast({
// title: '凝血酶原活动度未填写完整',
// icon:"none"
// })
// return false
// }
// if(!headIl6 || !afterIl6){
// flag && wx.showToast({
// title: '白介素6未填写完整',
title: '最后一次治疗后检测时间应该早于或者等于首次次治疗后检测时间',
icon:'none'
})
return false;
}
// if(caseType==2){
// if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){
// flag && wx.showToast({
// title: '治疗前检测时间应该在入院时间与第一次治疗时间之间',
// icon:"none"
// })
// return false
// }
// if(dpmas.length<2){
// if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0)){
// flag && wx.showToast({
// title: '治疗后检测时间应该在第一次之后',
// icon:"none"
// })
// return false
// }
// }else{
// let secondTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD')
// if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0 && dayjs(afterTime_new).diff(dayjs(secondTime))<=0)){
// flag && wx.showToast({
// title: '治疗后检测时间应该在第一次与第二次治疗时间之间',
// icon:"none"
// })
// return false
// };
// }
// if(!headTnf || !afterTnf){
// wx.showToast({
// title: '肿瘤坏死因子',
// icon:"none"
// })
// return false
// }
// };
// if(caseType==1){
// if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){
// flag && wx.showToast({
// title: '治疗前检测时间应该在入院时间与第一次治疗时间之间',
// icon:"none"
// })
// return false
// }
// if(!(dayjs(afterTime_new).diff(dayjs(lastTime)>=0))){
// flag && wx.showToast({
// title: '治疗后检测时间应该最后一次治疗时间之后',
// icon:"none"
// })
// return false
// }
// }
if(!headTb || !afterTb){
flag && wx.showToast({
title: '总胆红素首次治疗前后未填写完整',
icon:"none"
})
return false
};
if(dpmas.length>1){
if(!lastTb){
flag && wx.showToast({
title: '总胆红素最后一次治疗后不能为空',
icon:"none"
})
return false
}
}
if(!headAlt || !afterAlt){
flag && wx.showToast({
title: '丙氨酸氨基转移酶首次治疗前后未填写完整',
icon:"none"
})
return false
};
if(dpmas.length>1){
if(!lastAlt){
flag && wx.showToast({
title: '丙氨酸氨基转移酶最后一次治疗后不能为空',
icon:"none"
})
return false
}
}
if(!headAst || !afterAst){
flag && wx.showToast({
title: '天门冬氨酸氨基转移酶首次治疗前后未填写完整',
icon:"none"
})
return false
};
if(dpmas.length>1){
if(!lastAst){
flag && wx.showToast({
title: '天门冬氨酸氨基转移酶最后一次治疗后不能为空',
icon:"none"
})
return false
}
}
if(!headAlb || !afterAlb){
flag && wx.showToast({
title: '白蛋白首次治疗前后未填写完整',
icon:"none"
})
return false
};
if(dpmas.length>1){
if(!lastAlb){
flag && wx.showToast({
title: '白蛋白最后一次治疗后不能为空',
icon:"none"
})
return false
}
}
if(!headInr || !afterInr){
flag && wx.showToast({
title: '国际标准化比值首次治疗前后未填写完整',
icon:"none"
})
return false
}
if(dpmas.length>1){
if(!lastInr){
flag && wx.showToast({
title: '国际标准化比值最后一次治疗后不能为空',
icon:"none"
})
return false
}
}
if(fileList_check.length==0){
flag && wx.showToast({
title: '请上传报告单',
@ -844,6 +902,38 @@ Page({
}
return true;
},
validateBack(flag){
let {discharge_time,day,discharge_status,discharge_situation}=this.data.case;
if(!discharge_time){
flag && wx.showToast({
title: '请选择出院时间',
icon:"none"
})
return false
}
if(!day){
flag && wx.showToast({
title: '请输入住院天数',
icon:"none"
})
return false
}
if(!discharge_situation){
flag && wx.showToast({
title: '请输入出院情况',
icon:"none"
})
return false
}
if(!discharge_status){
flag && wx.showToast({
title: '请输入出院状态',
icon:"none"
})
return false
}
return true
},
onChangeAbstract(event){
let {value}=event.detail
this.setData({
@ -871,7 +961,7 @@ Page({
})
},
saveDraft(){
let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data;
let {fileList_basic,fileList_check,dpmas_list}=this.data;
let baseImg='';
let abstractImg='';
let checkImg='';
@ -882,13 +972,6 @@ Page({
baseImg+=item.url;
}
})
fileList_abstract.forEach(item=>{
if(abstractImg){
abstractImg+="," +item.url
}else{
abstractImg+=item.url;
}
})
fileList_check.forEach(item=>{
if(checkImg){
checkImg+="," +item.url
@ -999,13 +1082,13 @@ Page({
}else if(time_str=="dealTime"){
key="dealTime"
let year=dayjs(event.detail).format('YYYY')
if(year!=2024){
this.setData({
showTip:true,
showTime:false
})
return false
}
// if(year!=2024){
// this.setData({
// showTip:true,
// showTime:false
// })
// return false
// }
time=dayjs(event.detail).format('YYYY-MM-DD HH:mm');
}else if(time_str=="headTime"){
@ -1092,6 +1175,7 @@ Page({
time_type:'datetime',
time_str:"dealTime",
time_title:'选择治疗时间',
maxDate:new Date(dayjs().add(10,'year').toString()).getTime()
})
},
openHeadTime(){
@ -1123,7 +1207,7 @@ Page({
},
deleteImg(event){
const { fileList_basic,fileList_abstract,fileList_check,dpmas_list} = this.data;
const { fileList_basic,fileList_check,dpmas_list} = this.data;
const {name,index} = event.detail;
if(name=='basic'){
@ -1131,11 +1215,6 @@ Page({
this.setData({
fileList_basic:fileList_basic
})
}else if(name=="abstract"){
fileList_abstract.splice(index,1);
this.setData({
fileList_abstract:fileList_abstract
})
}else if(name=="check"){
fileList_check.splice(index,1);
this.setData({
@ -1157,7 +1236,7 @@ Page({
let { accessid, dir,policy,signature,host} = resdata;
let imgUrl = file;
//let index = imgUrl.lastIndexOf("/");
let filename = FileUtil.UUID()+'.'+imgUrl.match(/\.(\w+)$/)[1];
let filename = FileUtil.UUID()+'.'+THIS.getImageFormat(imgUrl);
//imgUrl.substring(index + 1, imgUrl.length);
@ -1174,6 +1253,10 @@ Page({
success(res) {
if (res.statusCode === 204) {
wx.showToast({
title: '图片上传成功',
icon: "none"
})
resolve(true)
let url = host + '/' + dir + filename;
// 上传完成需要更新 fileList
@ -1183,10 +1266,6 @@ Page({
const { fileList_basic} = THIS.data;
fileList_basic.push({ url: url });
THIS.setData({ fileList_basic });
}else if(name=='abstract'){
const { fileList_abstract} = THIS.data;
fileList_abstract.push({ url: url });
THIS.setData({ fileList_abstract });
}else if(name=='check'){
const { fileList_check} = THIS.data;
fileList_check.push({ url: url });
@ -1213,51 +1292,58 @@ Page({
})
},
afterRead(event) {
console.log( event.detail)
const { file,name} = event.detail;
console.log(file)
wx.showLoading({
getImageFormat(imageUrl){
console.log(imageUrl)
var parts = imageUrl.split('.');
return parts[parts.length - 1];
},
afterhandlePaint(e){
wx.showLoading({
title: '图片上传中',
mask: true
})
var promiseFun = [];
for (let i = 0; i < file.length; i++) {
var cur_file = file[i].url;
promiseFun.push(
this.uploadImg(cur_file,name)
)
};
Promise.all(promiseFun).then((res) => {
wx.showToast({
title: '图片上传成功',
icon: "none"
})
console.log(res.length+"张上传成功");
wx.hideLoading();
this.setData({
showPaint:false
})
const {imgSrc,name}=e.detail
console.log(e);
this.uploadImg(imgSrc,name)
},
afterRead(event) {
console.log( event.detail)
const { file,name} = event.detail;
this.setData({
paintSrc:file.url,
paintFrom:name,
showPaint:true
})
console.log(file)
// wx.showLoading({
// title: '图片上传中',
// mask: true
// })
// var promiseFun = [];
// for (let i = 0; i < file.length; i++) {
// var cur_file = file[i].url;
// promiseFun.push(
// this.uploadImg(cur_file,name)
// )
// };
// Promise.all(promiseFun).then((res) => {
// wx.showToast({
// title: '图片上传成功',
// icon: "none"
// })
// console.log(res.length+"张上传成功");
// wx.hideLoading();
}).catch(error=>{
wx.showToast({
title: '图片上传失败',
icon: "none"
})
console.log(error)
wx.hideLoading();
});
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
// wx.uploadFile({
// url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
// filePath: file.url,
// name: 'file',
// formData: { user: 'test' },
// success(res) {
// // 上传完成需要更新 fileList
// const { fileList = [] } = this.data;
// fileList.push({ ...file, url: res.data });
// this.setData({ fileList });
// },
// }).catch(error=>{
// wx.showToast({
// title: '图片上传失败',
// icon: "none"
// })
// console.log(error)
// wx.hideLoading();
// });
},
/**

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,17 @@
page{
overflow: hidden;
}
.container{
margin-top: 15rpx;
padding:20rpx 10rpx 50rpx;
border: 1rpx solid #E3E4E5;
border-radius:10rpx;
display: flex;
flex-direction: column;
}
.ql-container{
flex:1
}
.page{
overflow: hidden;
background: #F7F9F9;

View File

@ -11,6 +11,26 @@ Component({
});
},
},
paintFrom:{
type: String,
value:'',
observer(newval) {
this.setData({
paintFrom: newval
});
},
},
paintSrc:{
type: String,
value:'',
observer(newval) {
this.setData({
paintSrc: newval
});
this.initData();
},
}
},
ready(){
@ -34,6 +54,7 @@ Component({
*/
data: {
showPaint:false,
paintFrom:'',
hasChoosedImg: false,
canvasWidth: 0,
showBars: false,
@ -74,6 +95,29 @@ Component({
scope: false, // 是否有保存图片的权限
},
methods:{
initData(){
let that=this;
that.setData({
hasChoosedImg: true,
})
wx.getImageInfo({
src: this.data.paintSrc,
success: function (res) {
// 获取图片信息,主要为宽高,选择合适的自适应方式(将最大边完整显示)
console.log(res)
let [height, width] = [that.data.canvasWidth / res.width * res.height, that.data.canvasWidth];
if (height > that.data.windowHeight - 50) {
height = that.data.windowHeight - 50;
width = height / res.height * res.width;
}
that.setData({
canvasHeight: height,
canvasWidth: width,
background: res.path
});
}
})
},
hideTuya(){
this.setData({
showPaint:false,
@ -93,7 +137,7 @@ Component({
// this.triggerEvent('confirmUpload')
// },
tapBtn: function (e) {
utils.tapBtn(e, this, 2);
utils.tapBtn(e, this, 2,this.data.paintFrom);
},
showBarsHandler(e) {
//this.tapBtn(e)
@ -130,7 +174,7 @@ Component({
chooseImg() {
let that = this;
wx.chooseImage({
count:1,
count:1,
success: function (res) {
that.setData({
hasChoosedImg: true,
@ -189,7 +233,7 @@ Component({
this.setData({
prevPosition: [e.touches[0].x, e.touches[0].y]
})
console.log(11111)
},
clearCanvas: function (e) {

View File

@ -1,6 +1,6 @@
<!--painting-2.wxml-->
<van-overlay show="{{showPaint}}" z-index="99999999" >
<view class="upage" style="position:reltive;background-color: #000;height:100vh;" catch:tap="hideBarsHandler" >
<view class="upage" style="position:reltive;background-color: #000;height:100vh;" catch:tap="hideBarsHandler" wx:if="{{showPaint}}" >
<!-- <view class="ui-navigatorbar myclass colorCalss" >
<van-icon name="arrow-left" bindtap="hideTuya"
color="#fff"

View File

@ -42,7 +42,7 @@ function formatTime(date) {
}
// 点击按钮触发的事件
function tapBtn(e, _this, pageType) {
function tapBtn(e, _this, pageType,from) {
let btnType = e.target.dataset.type;
let c = {};
@ -94,14 +94,14 @@ function formatTime(date) {
return;
// 保存
case 'save':
saveImg(_this, pageType);
saveImg(_this, pageType,from);
return;
default:
return;
}
}
function saveImg(_this, pageType) {
function saveImg(_this, pageType,from) {
let c = {};
if (pageType === 1) {
c.canvasHeight = 50;
@ -164,51 +164,51 @@ function formatTime(date) {
ctx.drawImage(src, 0, 0, _this.data.canvasWidth, _this.data.canvasHeight);
ctx.draw();
_canvaseSaveToImg(_this);
_canvaseSaveToImg(_this,from);
}
},_this);
} else {
_canvaseSaveToImg(_this);
_canvaseSaveToImg(_this,from);
}
// }
}
function _canvaseSaveToImg(_this) {
function _canvaseSaveToImg(_this,from) {
// 调用微信canvas存为图片
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
success: function (res) {
// _this.triggerEvent('dealImg',{
// img: res.tempFilePath,
// type:'upload'
// })
// 转图片成功,继续调用存储相册接口
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
// 存储成功
success: function (r) {
wx.hideLoading();
wx.showToast({
title: '保存成功',
})
_this.setData({
saving: false,
showPaint:false
})
},
// 失败弹窗
fail: function (res) {
wx.hideLoading();
wx.showToast({
title: '保存失败',
icon: 'loading',
})
_this.setData({
saving: false,
showPaint:false
})
}
_this.triggerEvent('afterhandlePaint',{
imgSrc: res.tempFilePath,
name:from
})
// 转图片成功,继续调用存储相册接口
// wx.saveImageToPhotosAlbum({
// filePath: res.tempFilePath,
// // 存储成功
// success: function (r) {
// wx.hideLoading();
// wx.showToast({
// title: '保存成功',
// })
// _this.setData({
// saving: false,
// showPaint:false
// })
// },
// // 失败弹窗
// fail: function (res) {
// wx.hideLoading();
// wx.showToast({
// title: '保存失败',
// icon: 'loading',
// })
// _this.setData({
// saving: false,
// showPaint:false
// })
// }
// })
},
fail: function (res) {
// canvas转图片失败