8.26提交
This commit is contained in:
parent
d292fec408
commit
7799c04883
53
app.js
53
app.js
@ -2,7 +2,60 @@
|
||||
import { hostConfig} from "./utils/config"
|
||||
import router from './utils/router.js'
|
||||
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 () {
|
||||
|
||||
// 获取小程序更新管理器实例
|
||||
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,
|
||||
hostConfig: hostConfig,
|
||||
|
||||
@ -859,7 +859,7 @@ Page({
|
||||
if(res[key].mainDiagnoseImg){
|
||||
let imgList=res[key].mainDiagnoseImg.split(',');
|
||||
let arr=imgList.map(item=>{
|
||||
return {url:item}
|
||||
return {url:item,type:'image',isImage: true}
|
||||
})
|
||||
this.setData({
|
||||
'fileList_basic':arr
|
||||
@ -873,7 +873,7 @@ Page({
|
||||
this.setData({
|
||||
['case.'+key]:res[key],
|
||||
fileList_bio:imgList.map(item=>{
|
||||
return {url:item}
|
||||
return {url:item,type:'image',isImage: true}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -884,7 +884,7 @@ Page({
|
||||
this.setData({
|
||||
['case.'+key]:res[key],
|
||||
fileList_coa:imgList.map(item=>{
|
||||
return {url:item}
|
||||
return {url:item,type:'image',isImage: true}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -897,7 +897,7 @@ Page({
|
||||
this.setData({
|
||||
['case.'+key]:res[key],
|
||||
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"
|
||||
this.setData({
|
||||
[objFile]:imgList.map(item1=>{
|
||||
return {url:item1}
|
||||
return {url:item1,type:'image',isImage: true}
|
||||
}),
|
||||
[objTime]:item.treatTime?dayjs(item.treatTime).format('YYYY-MM-DD'):''
|
||||
})
|
||||
@ -1076,7 +1076,7 @@ Page({
|
||||
};
|
||||
this.setData({
|
||||
'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){
|
||||
this.setData({
|
||||
'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){
|
||||
// flag && wx.showToast({
|
||||
// title: '请选择诱因肝内类型',
|
||||
@ -1548,9 +1549,9 @@ Page({
|
||||
|
||||
if(dpmas.length>1){
|
||||
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({
|
||||
message: '首次人工肝治疗后检测时间应该早于第二次治疗时间',
|
||||
message: '首次人工肝治疗后检测时间应该不晚于第二次治疗时间',
|
||||
icon:'none'
|
||||
})
|
||||
return false;
|
||||
@ -2197,27 +2198,36 @@ Page({
|
||||
// 上传完成需要更新 fileList
|
||||
|
||||
console.log(url);
|
||||
console.log('name:'+name)
|
||||
if(name=='basic'){
|
||||
const { fileList_basic} = THIS.data;
|
||||
fileList_basic.push({ url: url });
|
||||
fileList_basic.push({ url: url,type:'image',isImage:true });
|
||||
THIS.setData({ fileList_basic });
|
||||
}else if(name=='bio'){
|
||||
const { fileList_bio} = THIS.data;
|
||||
fileList_bio.push({ url: url });
|
||||
fileList_bio.push({ url: url,type:'image',isImage: true });
|
||||
THIS.setData({ fileList_bio});
|
||||
}else if(name=='coa'){
|
||||
const { fileList_coa} = THIS.data;
|
||||
fileList_coa.push({ url: url });
|
||||
fileList_coa.push({ url: url,type:'image',isImage: true});
|
||||
THIS.setData({ fileList_coa});
|
||||
}else if(name=='inf'){
|
||||
const { fileList_inf} = THIS.data;
|
||||
fileList_inf.push({ url: url });
|
||||
fileList_inf.push({ url: url,type:'image',isImage: true });
|
||||
THIS.setData({ fileList_inf});
|
||||
}else if(name.indexOf("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({
|
||||
[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{
|
||||
console.log(444)
|
||||
|
||||
@ -104,11 +104,21 @@ Page({
|
||||
|
||||
if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1){
|
||||
wx.reLaunch({
|
||||
url:'/pages/index/index'
|
||||
url:'/pages/index/index',
|
||||
fail(){
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
wx.reLaunch({
|
||||
url:url
|
||||
url:url,
|
||||
fail(){
|
||||
wx.reLaunch({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
|
||||
@ -281,12 +281,15 @@ onCancelSuccess(){
|
||||
}
|
||||
wx.setStorageSync(token, data.token);
|
||||
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
|
||||
console.log(url)
|
||||
if(url.indexOf('login')!=-1 || url.indexOf('mobileLogin')!=-1 ){
|
||||
console.log(1)
|
||||
wx.reLaunch({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
|
||||
}else{
|
||||
console.log(2)
|
||||
wx.reLaunch({
|
||||
url:url
|
||||
})
|
||||
|
||||
@ -67,7 +67,7 @@ Component({
|
||||
prevPosition: [0, 0], // 手指触摸的所在位置
|
||||
background: '', // 背景图片,即导入的图片
|
||||
colors: ["#FFFFFF", "#000000", "#ff0000", "#ffff00", "#00CC00", "#99CCFF", "#0000ff", "#ff00ff"],
|
||||
selectColor:"#99CCFF",
|
||||
selectColor:"#000000",
|
||||
btnInfo: [
|
||||
{
|
||||
type: 'width',
|
||||
@ -247,7 +247,7 @@ Component({
|
||||
},
|
||||
|
||||
clearCanvas: function (e) {
|
||||
this.tapBtn(e)
|
||||
//this.tapBtn(e)
|
||||
let ctx = wx.createCanvasContext('myCanvas',this);
|
||||
ctx.clearRect(0, 0, this.data.canvasWidth, this.data.canvasHeight);
|
||||
ctx.draw();
|
||||
|
||||
@ -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(){
|
||||
this.storeBindings = createStoreBindings(this, {
|
||||
store,
|
||||
fields: [,"active"],
|
||||
actions: ["updateActive"],
|
||||
});
|
||||
this.getAuthStatus();
|
||||
if(this.isHasToken()){
|
||||
this.getAuthStatus();
|
||||
}
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
this.storeBindings.destroyStoreBindings();
|
||||
@ -486,8 +504,11 @@ getBank(){
|
||||
status:'',
|
||||
caseType:''
|
||||
})
|
||||
this.toggleDraft();
|
||||
this.handleRefresher();
|
||||
if(this.isHasToken()){
|
||||
this.toggleDraft();
|
||||
this.handleRefresher();
|
||||
}
|
||||
|
||||
|
||||
wx.getPrivacySetting({
|
||||
success: res => {
|
||||
|
||||
108
utils/utils.js
108
utils/utils.js
@ -162,9 +162,13 @@ function formatTime(date) {
|
||||
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.draw();
|
||||
//let that=this
|
||||
ctx.draw(false,function(){
|
||||
_canvaseSaveToImg(_this,from);
|
||||
|
||||
});
|
||||
|
||||
_canvaseSaveToImg(_this,from);
|
||||
|
||||
}
|
||||
},_this);
|
||||
} else {
|
||||
@ -174,51 +178,63 @@ function formatTime(date) {
|
||||
}
|
||||
|
||||
function _canvaseSaveToImg(_this,from) {
|
||||
let that=_this;
|
||||
console.log(from)
|
||||
console.log(_this);
|
||||
|
||||
// 调用微信canvas存为图片
|
||||
wx.canvasToTempFilePath({
|
||||
canvasId: 'myCanvas',
|
||||
success: function (res) {
|
||||
_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转图片失败
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
icon: 'loading',
|
||||
title: '失败',
|
||||
})
|
||||
}
|
||||
},_this)
|
||||
setTimeout(()=>{
|
||||
wx.canvasToTempFilePath({
|
||||
canvasId: 'myCanvas',
|
||||
fileType:'png',
|
||||
success: function (res) {
|
||||
// wx.previewImage({
|
||||
// urls:[res.tempFilePath],
|
||||
// current:res.tempFilePath
|
||||
// })
|
||||
that.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转图片失败
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
icon: 'loading',
|
||||
title: '失败',
|
||||
})
|
||||
}
|
||||
},that)
|
||||
},1500)
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user