8.26提交

This commit is contained in:
zoujiandong 2025-08-26 17:21:01 +08:00
parent d292fec408
commit 7799c04883
7 changed files with 181 additions and 68 deletions

53
app.js
View File

@ -2,7 +2,60 @@
import { hostConfig} from "./utils/config" import { hostConfig} from "./utils/config"
import router from './utils/router.js' import router from './utils/router.js'
App({ App({
onShow:function(){
wx.getSystemInfo({
success: (res) => {
// windows | mac为pc端
// android | ios为手机端
console.log('getSystemInfo,', res.platform);
if( res.platform=="windows" || res.platform=="mac"){
wx.showModal({
title: '提示',
showCancel:false,
content: '请使用手机端登录',
complete: (res) => {
wx.exitMiniProgram()
}
})
}
}
});
},
onLaunch: function () { onLaunch: function () {
// 获取小程序更新管理器实例
const updateManager = wx.getUpdateManager();
// 监听检查更新事件,当小程序有新版本时会触发此回调
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate); // 打印是否有新版本
});
// 监听更新准备就绪事件,当新版本下载完成时会触发此回调
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
showCancel:false,
content: '小程序版本已经更新,请重新进入!',
success(res) {
if (res.confirm) {
// 用户确认更新,调用 applyUpdate 应用新版本并重启小程序
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function () {
wx.showModal({
title: '更新失败',
content:'已经有新版本了,请您删除当前小程序,重新搜索打开',
});
// 新版本下载失败,可以在这里处理失败逻辑,例如提示用户稍后再试
});
}, },
method: router, method: router,
hostConfig: hostConfig, hostConfig: hostConfig,

View File

@ -859,7 +859,7 @@ Page({
if(res[key].mainDiagnoseImg){ if(res[key].mainDiagnoseImg){
let imgList=res[key].mainDiagnoseImg.split(','); let imgList=res[key].mainDiagnoseImg.split(',');
let arr=imgList.map(item=>{ let arr=imgList.map(item=>{
return {url:item} return {url:item,type:'image',isImage: true}
}) })
this.setData({ this.setData({
'fileList_basic':arr 'fileList_basic':arr
@ -873,7 +873,7 @@ Page({
this.setData({ this.setData({
['case.'+key]:res[key], ['case.'+key]:res[key],
fileList_bio:imgList.map(item=>{ fileList_bio:imgList.map(item=>{
return {url:item} return {url:item,type:'image',isImage: true}
}) })
}) })
} }
@ -884,7 +884,7 @@ Page({
this.setData({ this.setData({
['case.'+key]:res[key], ['case.'+key]:res[key],
fileList_coa:imgList.map(item=>{ fileList_coa:imgList.map(item=>{
return {url:item} return {url:item,type:'image',isImage: true}
}) })
}) })
} }
@ -897,7 +897,7 @@ Page({
this.setData({ this.setData({
['case.'+key]:res[key], ['case.'+key]:res[key],
fileList_inf:imgList.map(item=>{ fileList_inf:imgList.map(item=>{
return {url:item} return {url:item,type:'image',isImage: true}
}) })
}) })
} }
@ -915,7 +915,7 @@ Page({
let objTime="dpmas_list["+index+"].treatTime" let objTime="dpmas_list["+index+"].treatTime"
this.setData({ this.setData({
[objFile]:imgList.map(item1=>{ [objFile]:imgList.map(item1=>{
return {url:item1} return {url:item1,type:'image',isImage: true}
}), }),
[objTime]:item.treatTime?dayjs(item.treatTime).format('YYYY-MM-DD'):'' [objTime]:item.treatTime?dayjs(item.treatTime).format('YYYY-MM-DD'):''
}) })
@ -1076,7 +1076,7 @@ Page({
}; };
this.setData({ this.setData({
'case.dpmas':this.data.case.dpmas.concat([obj]), 'case.dpmas':this.data.case.dpmas.concat([obj]),
'dpmas_list':this.data.dpmas_list.concat({fileList:[],treatTime:''}) 'dpmas_list':this.data.dpmas_list.concat([{fileList:[],treatTime:''}])
}) })
}, },
@ -1245,11 +1245,12 @@ Page({
if(dpmas.length<=1){ if(dpmas.length<=1){
this.setData({ this.setData({
'case.dpmas':dpmas.concat([obj]), 'case.dpmas':dpmas.concat([obj]),
'dpmas_list':dpmas_list.concat({fileList:[],treatTime:''}) 'dpmas_list':dpmas_list.concat([{fileList:[],treatTime:''}])
}) })
} }
} }
// if(seductionReason.inside.select.length==0){ // if(seductionReason.inside.select.length==0){
// flag && wx.showToast({ // flag && wx.showToast({
// title: '请选择诱因肝内类型', // title: '请选择诱因肝内类型',
@ -1548,9 +1549,9 @@ Page({
if(dpmas.length>1){ if(dpmas.length>1){
let secondTreatTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD') let secondTreatTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD')
if(dayjs(afterTime_new).diff(dayjs(secondTreatTime))>=0){ if(dayjs(afterTime_new).diff(dayjs(secondTreatTime))>0){
flag && Toast({ flag && Toast({
message: '首次人工肝治疗后检测时间应该于第二次治疗时间', message: '首次人工肝治疗后检测时间应该不晚于第二次治疗时间',
icon:'none' icon:'none'
}) })
return false; return false;
@ -2197,27 +2198,36 @@ Page({
// 上传完成需要更新 fileList // 上传完成需要更新 fileList
console.log(url); console.log(url);
console.log('name:'+name)
if(name=='basic'){ if(name=='basic'){
const { fileList_basic} = THIS.data; const { fileList_basic} = THIS.data;
fileList_basic.push({ url: url }); fileList_basic.push({ url: url,type:'image',isImage:true });
THIS.setData({ fileList_basic }); THIS.setData({ fileList_basic });
}else if(name=='bio'){ }else if(name=='bio'){
const { fileList_bio} = THIS.data; const { fileList_bio} = THIS.data;
fileList_bio.push({ url: url }); fileList_bio.push({ url: url,type:'image',isImage: true });
THIS.setData({ fileList_bio}); THIS.setData({ fileList_bio});
}else if(name=='coa'){ }else if(name=='coa'){
const { fileList_coa} = THIS.data; const { fileList_coa} = THIS.data;
fileList_coa.push({ url: url }); fileList_coa.push({ url: url,type:'image',isImage: true});
THIS.setData({ fileList_coa}); THIS.setData({ fileList_coa});
}else if(name=='inf'){ }else if(name=='inf'){
const { fileList_inf} = THIS.data; const { fileList_inf} = THIS.data;
fileList_inf.push({ url: url }); fileList_inf.push({ url: url,type:'image',isImage: true });
THIS.setData({ fileList_inf}); THIS.setData({ fileList_inf});
}else if(name.indexOf("record")!=-1){ }else if(name.indexOf("record")!=-1){
let recordIndex=Number(name.split("record")[1]); let recordIndex=Number(name.split("record")[1]);
let obj="dpmas_list[" +recordIndex +"].fileList" console.log("recordIndex:"+recordIndex);
let objArr="dpmas_list[" +recordIndex +"]"
let obj="dpmas_list[" +recordIndex +"].fileList"
if(!(THIS.data.dpmas_list[recordIndex])){
console.log(333)
THIS.setData({
[objArr]:{fileList:[],treatTime:''}
})
}
THIS.setData({ THIS.setData({
[obj]:THIS.data.dpmas_list[recordIndex].fileList.concat([{ url: url }]) [obj]:THIS.data.dpmas_list[recordIndex].fileList.concat([{ url: url,type:'image',isImage: true}])
}) })
}else{ }else{
console.log(444) console.log(444)

View File

@ -104,11 +104,21 @@ Page({
if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1){ if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1){
wx.reLaunch({ wx.reLaunch({
url:'/pages/index/index' url:'/pages/index/index',
fail(){
wx.switchTab({
url: '/pages/index/index',
})
}
}) })
}else{ }else{
wx.reLaunch({ wx.reLaunch({
url:url url:url,
fail(){
wx.reLaunch({
url:'/pages/index/index'
})
}
}) })
} }
}).catch(error=>{ }).catch(error=>{

View File

@ -281,12 +281,15 @@ onCancelSuccess(){
} }
 wx.setStorageSync(token, data.token);  wx.setStorageSync(token, data.token);
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index'; let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
console.log(url)
if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1 ){ if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1 ){
console.log(1)
wx.reLaunch({ wx.reLaunch({
url:'/pages/index/index' url:'/pages/index/index'
}) })
}else{ }else{
console.log(2)
wx.reLaunch({ wx.reLaunch({
url:url url:url
}) })

View File

@ -67,7 +67,7 @@ Component({
prevPosition: [0, 0], // 手指触摸的所在位置 prevPosition: [0, 0], // 手指触摸的所在位置
background: '', // 背景图片,即导入的图片 background: '', // 背景图片,即导入的图片
colors: ["#FFFFFF", "#000000", "#ff0000", "#ffff00", "#00CC00", "#99CCFF", "#0000ff", "#ff00ff"], colors: ["#FFFFFF", "#000000", "#ff0000", "#ffff00", "#00CC00", "#99CCFF", "#0000ff", "#ff00ff"],
selectColor:"#99CCFF", selectColor:"#000000",
btnInfo: [ btnInfo: [
{ {
type: 'width', type: 'width',
@ -247,7 +247,7 @@ Component({
}, },
clearCanvas: function (e) { clearCanvas: function (e) {
this.tapBtn(e) //this.tapBtn(e)
let ctx = wx.createCanvasContext('myCanvas',this); let ctx = wx.createCanvasContext('myCanvas',this);
ctx.clearRect(0, 0, this.data.canvasWidth, this.data.canvasHeight); ctx.clearRect(0, 0, this.data.canvasWidth, this.data.canvasHeight);
ctx.draw(); ctx.draw();

View File

@ -460,13 +460,31 @@ getBank(){
}) })
} }
}, },
isHasToken(){
let tokenStr=''
const { envVersion } = wx.getAccountInfoSync().miniProgram;
if(envVersion=="develop" || envVersion=="trial"){
tokenStr="DEV_CASE_TOKEN"
}else{
tokenStr="PROD_CASE_TOKEN"
}
let token = wx.getStorageSync(tokenStr);
if(token){
return true
}else {
return false
}
},
onLoad(){ onLoad(){
this.storeBindings = createStoreBindings(this, { this.storeBindings = createStoreBindings(this, {
store, store,
fields: [,"active"], fields: [,"active"],
actions: ["updateActive"], actions: ["updateActive"],
}); });
this.getAuthStatus(); if(this.isHasToken()){
this.getAuthStatus();
}
}, },
onUnload() { onUnload() {
this.storeBindings.destroyStoreBindings(); this.storeBindings.destroyStoreBindings();
@ -486,8 +504,11 @@ getBank(){
status:'', status:'',
caseType:'' caseType:''
}) })
this.toggleDraft(); if(this.isHasToken()){
this.handleRefresher(); this.toggleDraft();
this.handleRefresher();
}
wx.getPrivacySetting({ wx.getPrivacySetting({
success: res => { success: res => {

View File

@ -162,9 +162,13 @@ function formatTime(date) {
ctx.drawImage(_this.data.background, 0, 0, _this.data.canvasWidth, _this.data.canvasHeight); ctx.drawImage(_this.data.background, 0, 0, _this.data.canvasWidth, _this.data.canvasHeight);
// 覆盖上画的内容 // 覆盖上画的内容
ctx.drawImage(src, 0, 0, _this.data.canvasWidth, _this.data.canvasHeight); ctx.drawImage(src, 0, 0, _this.data.canvasWidth, _this.data.canvasHeight);
ctx.draw(); //let that=this
ctx.draw(false,function(){
_canvaseSaveToImg(_this,from);
});
_canvaseSaveToImg(_this,from);
} }
},_this); },_this);
} else { } else {
@ -174,51 +178,63 @@ function formatTime(date) {
} }
function _canvaseSaveToImg(_this,from) { function _canvaseSaveToImg(_this,from) {
let that=_this;
console.log(from)
console.log(_this);
// 调用微信canvas存为图片 // 调用微信canvas存为图片
wx.canvasToTempFilePath({ setTimeout(()=>{
canvasId: 'myCanvas', wx.canvasToTempFilePath({
success: function (res) { canvasId: 'myCanvas',
_this.triggerEvent('afterhandlePaint',{ fileType:'png',
imgSrc: res.tempFilePath, success: function (res) {
name:from // wx.previewImage({
}) // urls:[res.tempFilePath],
// 转图片成功,继续调用存储相册接口 // current:res.tempFilePath
// wx.saveImageToPhotosAlbum({ // })
// filePath: res.tempFilePath, that.triggerEvent('afterhandlePaint',{
// // 存储成功 imgSrc: res.tempFilePath,
// success: function (r) { name:from
// wx.hideLoading(); })
// wx.showToast({ // 转图片成功,继续调用存储相册接口
// title: '保存成功', // wx.saveImageToPhotosAlbum({
// }) // filePath: res.tempFilePath,
// _this.setData({ // // 存储成功
// saving: false, // success: function (r) {
// showPaint:false // wx.hideLoading();
// }) // wx.showToast({
// }, // title: '保存成功',
// // 失败弹窗 // })
// fail: function (res) { // _this.setData({
// wx.hideLoading(); // saving: false,
// wx.showToast({ // showPaint:false
// title: '保存失败', // })
// icon: 'loading', // },
// }) // // 失败弹窗
// _this.setData({ // fail: function (res) {
// saving: false, // wx.hideLoading();
// showPaint:false // wx.showToast({
// }) // title: '保存失败',
// } // icon: 'loading',
// }) // })
}, // _this.setData({
fail: function (res) { // saving: false,
// canvas转图片失败 // showPaint:false
wx.hideLoading(); // })
wx.showToast({ // }
icon: 'loading', // })
title: '失败', },
}) fail: function (res) {
} // canvas转图片失败
},_this) wx.hideLoading();
wx.showToast({
icon: 'loading',
title: '失败',
})
}
},that)
},1500)
} }
module.exports = { module.exports = {