6.19
This commit is contained in:
parent
5aaa605a13
commit
5a887c8dea
4
app.json
4
app.json
@ -16,8 +16,8 @@
|
||||
"pages/pwdLogin/pwdLogin",
|
||||
"pages/privacy/privacy",
|
||||
"pages/bankCard/bankCard",
|
||||
"pages/paintCanvas/paintCanvas",
|
||||
"pages/paintDraw/paintDraw"
|
||||
"pages/paintDraw/paintDraw",
|
||||
"pages/paintCanvas/paintCanvas"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -3,12 +3,21 @@ import {addCase,caseDetail,editCase,getOssSign} from "../../../api/api"
|
||||
const dayjs = require("../../../utils/dayjs");
|
||||
import {throttle} from "../../../utils/util"
|
||||
import { FileUtil } from '../../../utils/fileutil'
|
||||
import {diagnoseOption,patientSickOption,ganneiOption,ganwaiOption,moshiOption,hospitalOption,kangningOption} from "../../utils/data"
|
||||
const app=getApp();
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
value:[],
|
||||
kangningOption:kangningOption,
|
||||
diagnoseOption:diagnoseOption,
|
||||
patientSickOption:patientSickOption,
|
||||
ganneiOption:ganneiOption,
|
||||
ganwaiOption:ganwaiOption,
|
||||
moshiOption:moshiOption,
|
||||
hospitalOption:hospitalOption,
|
||||
active:0,
|
||||
wordLength:0,
|
||||
showSaveBtn:true,
|
||||
@ -101,6 +110,40 @@ Page({
|
||||
}
|
||||
return value;
|
||||
},
|
||||
|
||||
},
|
||||
onChangeCheck(event){
|
||||
console.log(event);
|
||||
let arr=event.detail;
|
||||
this.setData({
|
||||
value:arr
|
||||
})
|
||||
if(arr[arr.length-1]=="-1"){
|
||||
this.setData({
|
||||
value:["-1"]
|
||||
})
|
||||
}else{
|
||||
let index=arr.indexOf("-1");
|
||||
if(index>-1){
|
||||
arr.splice(index, 1);
|
||||
this.setData({
|
||||
value:arr
|
||||
})
|
||||
}
|
||||
}
|
||||
console.log(this.data.value)
|
||||
},
|
||||
onChangeOther(event){
|
||||
let {detail,currentTarget}=event;
|
||||
this.setData({
|
||||
[currentTarget.dataset.type]:detail.value
|
||||
})
|
||||
},
|
||||
toggleCheck(event){
|
||||
console.log(event);
|
||||
},
|
||||
dealImg(e){
|
||||
console.log(e);
|
||||
},
|
||||
save:throttle(function(){
|
||||
this.data.medicalRecordId?this.handleEditCase():this.handleAddCase();
|
||||
@ -209,7 +252,6 @@ Page({
|
||||
headTime:dayjs(headTime).format('YYYY-MM-DD HH:mm:ss'),
|
||||
afterTime:dayjs(afterTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
})
|
||||
|
||||
addCase({...caseObj}).then(res=>{
|
||||
wx.showToast({
|
||||
title: '病例创建成功',
|
||||
@ -300,26 +342,19 @@ Page({
|
||||
['case.'+key]:res[key]?dayjs(res[key]).format('YYYY-MM-DD'):''
|
||||
})
|
||||
}else if(key=='caseType'){
|
||||
let {columns}=this.data;
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
if(columns[i].value==res[key]){
|
||||
this.setData({
|
||||
['case.'+key]:res[key],
|
||||
'typeName': columns[i].text
|
||||
})
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}else if(key=='baseImg'){
|
||||
if(res[key]){
|
||||
let imgList=res[key].split(',');
|
||||
|
||||
}else if(key=='main_diagnose'){
|
||||
this.setData({
|
||||
'case.main_diagnose.select':res[key].select,
|
||||
'case.main_diagnose.otherValue':res[key].otherValue
|
||||
})
|
||||
if(res[key].main_diagnose_img.length>0){
|
||||
let arr=res[key].main_diagnose_img.map(item=>{
|
||||
url:item
|
||||
})
|
||||
this.setData({
|
||||
['case.'+key]:res[key],
|
||||
fileList_basic:imgList.map(item=>{
|
||||
return {url:item}
|
||||
})
|
||||
})
|
||||
'case.main_diagnose.main_diagnose_img':arr
|
||||
})
|
||||
}
|
||||
|
||||
}else if(key=='abstractImg'){
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
|
||||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"paintCanvas":"../../../components/paintCanvas/paintCanvas",
|
||||
"van-radio-group": "@vant/weapp/radio-group/index"
|
||||
},
|
||||
"navigationStyle":"custom"
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
治疗类型(多选)<text class="red">*</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox-group value="{{case.case_type }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">DPMAS及联合模式</van-checkbox>
|
||||
<van-checkbox name="{{2}}">CA280及联合模式</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
@ -72,16 +72,16 @@
|
||||
主要诊断(多选)<text class="red">*</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">肝衰竭 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">肿瘤</van-checkbox>
|
||||
<van-checkbox name="{{2}}">胆汁淤积性肝病</van-checkbox>
|
||||
<van-checkbox name="{{2}}">移植围手术期支持治疗</van-checkbox>
|
||||
<van-checkbox name="{{2}}">伴黄疸的MODS或脓毒症、重症中毒等</van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox>
|
||||
<van-checkbox-group bind:change="onChangeCheck" value="{{case.main_diagnose.select}}" disabled="{{!showSaveBtn}}" direction="horizontal" data-type="main_diagnose">
|
||||
<van-checkbox name="{{item.value}}" wx:for="{{diagnoseOption}}" wx:key="value"
|
||||
data-value="{{item.value}}"
|
||||
>{{item.name}}</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.main_diagnose.otherValue}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入其他诊断" bind:input="onChangeOther"
|
||||
bind:change="onChangeOther"
|
||||
data-type="case.main_diagnose.otherValue"
|
||||
placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<!-- <view class="word">{{wordLength}}/500</view> -->
|
||||
|
||||
</view>
|
||||
@ -90,27 +90,20 @@
|
||||
患者病因(多选)<text class="red">*</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">乙肝 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">丙肝</van-checkbox>
|
||||
<van-checkbox name="{{2}}">酒精性肝病</van-checkbox>
|
||||
<van-checkbox name="{{2}}">酒精性肝硬化</van-checkbox>
|
||||
<van-checkbox name="{{2}}">自身免疫性肝炎(AIH)</van-checkbox>
|
||||
<van-checkbox name="{{2}}">原发性胆汁性肝硬化(PBC)</van-checkbox>
|
||||
<van-checkbox name="{{2}}">原发性硬化性胆管炎(PSC)</van-checkbox>
|
||||
<van-checkbox name="{{2}}">非酒精性脂肪肝</van-checkbox>
|
||||
<van-checkbox name="{{2}}">药物性肝损伤</van-checkbox>
|
||||
<van-checkbox name="{{2}}">肝豆状核变性</van-checkbox>
|
||||
<van-checkbox name="{{2}}">甲肝</van-checkbox>
|
||||
<van-checkbox name="{{2}}">戊肝</van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox>
|
||||
<van-checkbox-group value="{{ case.disease_cause.select }}" bind:change="onChangeCheck" data-type="disease_cause" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{item.value}}" wx:for="{{patientSickOption}}" wx:key="value">{{item.name}}</van-checkbox>
|
||||
|
||||
</van-checkbox-group>
|
||||
</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.disease_cause.otherValue}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入其他患者原因" bind:input="onChangeOther" bind:change="onChangeOther"
|
||||
data-type="case.disease_cause.otherValue"
|
||||
placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<!-- <view class="word">{{wordLength}}/500</view> -->
|
||||
<view class="left" style="margin-top: 12rpx;">患者出院诊断照片(可上传1-6张)</view>
|
||||
<view class="uploadbox">
|
||||
<van-uploader file-list="{{ fileList_basic }}" name="basic" deletable="{{showSaveBtn}}" show-upload="{{showSaveBtn}}" bind:delete="deleteImg" max-count="6" multiple bind:after-read="afterRead" upload-text="上传" upload-icon="{{img_host+'/upload.png'}}" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="row" style="flex-direction: column;">
|
||||
<view class="left">
|
||||
@ -119,39 +112,30 @@
|
||||
<view class="desctitle">肝内:</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">乙肝再激活 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">大量饮酒</van-checkbox>
|
||||
<van-checkbox name="{{2}}">药物毒物</van-checkbox>
|
||||
<van-checkbox name="{{2}}">戊型肝炎感染</van-checkbox>
|
||||
<van-checkbox name="{{2}}">甲型肝炎感染</van-checkbox>
|
||||
<van-checkbox name="{{2}}">丙肝再激活 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox>
|
||||
<van-checkbox name="{{item.value}}" wx:for="{{ganneiOption}}" wx:key="value">{{item.name}}</van-checkbox>
|
||||
|
||||
</van-checkbox-group>
|
||||
</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入肝内诱因" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<view class="desctitle">肝外:</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">消化道出血 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">感染 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">手术 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">劳累</van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox>
|
||||
<van-checkbox name="{{item.value}}" wx:for="{{ganwaiOption}}" wx:key="value">{{item.name}} </van-checkbox>
|
||||
</van-checkbox-group>
|
||||
|
||||
</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入肝外诱因" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<!-- <view class="word">{{wordLength}}/500</view> -->
|
||||
|
||||
</view>
|
||||
<view class="row" style="flex-direction: column;">
|
||||
<!-- <view class="row" style="flex-direction: column;">
|
||||
<view class="left">
|
||||
病案照片(可上传1-6张)<text class="red">*</text>
|
||||
</view>
|
||||
<view class="uploadbox">
|
||||
<van-uploader file-list="{{ fileList_basic }}" name="basic" deletable="{{showSaveBtn}}" show-upload="{{showSaveBtn}}" bind:delete="deleteImg" max-count="6" multiple bind:after-read="afterRead" upload-text="上传" upload-icon="{{img_host+'/upload.png'}}" />
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="tip" style="padding-bottom: 130rpx;">注意:“病案首页”需包含患者住院号或姓名</view>
|
||||
<view class="btnbox" wx:if="{{showSaveBtn}}">
|
||||
@ -170,7 +154,7 @@
|
||||
</view>
|
||||
<view class="unit">
|
||||
<view class="desctitle">主诉:</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入主诉" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<view class="word">
|
||||
<view class="textdesc">
|
||||
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead">
|
||||
@ -183,7 +167,7 @@
|
||||
</view>
|
||||
<view class="unit">
|
||||
<view class="desctitle">现病史:</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入现病史" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<view class="word">
|
||||
<view class="textdesc">
|
||||
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead">
|
||||
@ -197,7 +181,7 @@
|
||||
</view>
|
||||
<view class="unit">
|
||||
<view class="desctitle">既往史:</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入既往史" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<view class="word">
|
||||
<view class="textdesc">
|
||||
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead">
|
||||
@ -253,14 +237,11 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-radio-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-radio name="{{1}}">DPMAS</van-radio>
|
||||
<van-radio name="{{1}}">DPMAS+PE</van-radio>
|
||||
<van-radio name="{{1}}">DPMAS+其他</van-radio>
|
||||
<van-radio name="{{1}}">CA280吸附</van-radio>
|
||||
<van-radio name="{{1}}">DPCAS</van-radio>
|
||||
<van-radio name="{{item.value}}" wx:for="{{moshiOption}}" wx:key="value">{{item.name}}</van-radio>
|
||||
|
||||
</van-radio-group>
|
||||
</view>
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入其他模式" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
@ -284,15 +265,15 @@
|
||||
</view>
|
||||
<view class="row" style="flex-direction: column;">
|
||||
<view class="left">
|
||||
抗凝剂量<text class="red"></text>
|
||||
抗凝剂量(多选)<text class="red"></text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-checkbox-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-checkbox name="{{1}}">肝素 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">低分子肝素 </van-checkbox>
|
||||
<van-checkbox name="{{item.value}}" wx:for="{{kangningOption}}" wx:key="value">{{item.name}}</van-checkbox>
|
||||
<!-- <van-checkbox name="{{2}}">低分子肝素 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">枸橼酸 </van-checkbox>
|
||||
<van-checkbox name="{{2}}">甲磺酸萘莫司他</van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox>
|
||||
<van-checkbox name="{{2}}">其他</van-checkbox> -->
|
||||
</van-checkbox-group>
|
||||
|
||||
</view>
|
||||
@ -738,7 +719,7 @@
|
||||
出院情况<text class="red">*</text>
|
||||
</view>
|
||||
<view class="unit" style="border:none;margin-bottom:0;">
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入病历摘要" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<textarea value="{{case.abstractStr}}" disabled="{{!showSaveBtn}}" class="textArea" placeholder="请输入出院情况" bind:input="onChangeAbstract" bind:change="onChangeAbstract" placeholder-style="color:rgba(0,0,0,0.25)" confirm-type="done" maxlength="500" auto-height="{{true}}" />
|
||||
<view class="word">
|
||||
<view class="textdesc">
|
||||
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead">
|
||||
@ -752,15 +733,12 @@
|
||||
</view>
|
||||
<view class="row back" style="flex-direction: column;">
|
||||
<view class="left">
|
||||
出院状态<text class="red">*</text>
|
||||
出院状态(单选)<text class="red">*</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-radio-group value="{{ case.sex }}" bind:change="onChange" disabled="{{!showSaveBtn}}" direction="horizontal">
|
||||
<van-radio name="{{1}}">好转</van-radio>
|
||||
<van-radio name="{{2}}">痊愈 </van-radio>
|
||||
<van-radio name="{{2}}">恶化 </van-radio>
|
||||
<van-radio name="{{2}}">死亡 </van-radio>
|
||||
<van-radio name="{{2}}">移植 </van-radio>
|
||||
<van-radio name="{{item.value}}" wx:for="{{hospitalOption}}" wx:key="value">{{item.name}}</van-radio>
|
||||
|
||||
</van-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
@ -783,6 +761,7 @@
|
||||
</dialog>
|
||||
<dialog showDialog="{{showUseDraft}}" title="提示" message="加载上次草稿?" showCancel="{{false}}" confirmText="确定" bind:confirm="onConfirmUseDraft" bind:cancel="onCancelUseDraft">
|
||||
</dialog>
|
||||
<paintCanvas showPaint="{{showPaint}}" bind:dealImg="dealImg"></paintCanvas>
|
||||
<van-popup show="{{ showType }}" round position="bottom" custom-style="height: 50%">
|
||||
<van-picker columns="{{ columns }}" default-index="{{case.caseType}}" title="请选择病例类型" bind:cancel="onCancelType" show-toolbar bind:confirm="onConfirmType" />
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ page{
|
||||
}
|
||||
.unit .con{
|
||||
display: flex;
|
||||
padding: 5rpx 0;
|
||||
align-items: center;
|
||||
}
|
||||
.van-checkbox-group--horizontal{
|
||||
@ -366,9 +367,10 @@ color: #3881F7;
|
||||
.textArea{
|
||||
margin-top: 20rpx;
|
||||
width:100%;
|
||||
max-height: 500rpx!important;
|
||||
max-height: 600rpx!important;
|
||||
min-height: 200rpx!important;
|
||||
font-size: 15px;
|
||||
min-height:50rpx!important;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 30px;
|
||||
display: block!important;
|
||||
}
|
||||
@ -377,7 +379,8 @@ color: #3881F7;
|
||||
|
||||
|
||||
position: absolute;
|
||||
bottom:10rpx;
|
||||
bottom:32rpx;
|
||||
|
||||
color: rgba(0,0,0,0.25);
|
||||
right:10rpx;
|
||||
}
|
||||
@ -404,3 +407,21 @@ color: #3881F7;
|
||||
.van-radio__label--disabled{
|
||||
color:#000!important;
|
||||
}
|
||||
.basic .textArea{
|
||||
border-radius:10px;
|
||||
padding:10px;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid rgba(0,0,0,0.1);
|
||||
}
|
||||
.basic .desctitle{
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
.ziliao .textArea,.back .textArea{
|
||||
padding-bottom: 30px;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.record .textArea{
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
showPaint:false,
|
||||
hasChoosedImg: false,
|
||||
canvasWidth: 0,
|
||||
showBars: false,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--painting-2.wxml-->
|
||||
<view class="page" style="background-color: #000;height:100vh;" catch:tap="hideBarsHandler">
|
||||
<canvas canvas-id="myCanvas" disable-scroll="true" bindtouchstart="touchStart"
|
||||
<canvas type="2d" id="myCanvas" disable-scroll="true" bindtouchstart="touchStart"
|
||||
bindtouchmove="touchMove" bindtouchend="touchEnd" wx:if="{{hasChoosedImg}}"
|
||||
style="height: {{(canvasHeightLen == 0) ? canvasHeight : canvasHeightLen}}px; width: {{canvasWidth}}px; background: url('{{background}}');background-position: 0 0; background-size: {{canvasWidth}}px {{canvasHeight}}px"
|
||||
/>
|
||||
|
||||
@ -55,6 +55,7 @@ page {
|
||||
.space {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
text-shadow: 2px 2px 1px #000000;
|
||||
}
|
||||
.bottom {
|
||||
width: 750rpx;
|
||||
|
||||
@ -50,4 +50,5 @@ page {
|
||||
.space {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
168
case/utils/data.js
Normal file
168
case/utils/data.js
Normal file
@ -0,0 +1,168 @@
|
||||
const diagnoseOption=[
|
||||
{
|
||||
name:'肝衰竭',
|
||||
value:0,
|
||||
},{
|
||||
name:'肿瘤',
|
||||
value:1
|
||||
},{
|
||||
name:'胆汁淤积性肝病',
|
||||
value:2
|
||||
},
|
||||
{
|
||||
name:'移植围手术期支持治疗',
|
||||
value:3
|
||||
},
|
||||
{
|
||||
name:'伴黄疸的MODS或脓毒症、重症中毒等',
|
||||
value:4
|
||||
},
|
||||
{
|
||||
name:'其他',
|
||||
value:-1
|
||||
}]
|
||||
const patientSickOption=[{
|
||||
name:'乙肝',
|
||||
value:0
|
||||
},{
|
||||
name:'丙肝',
|
||||
value:1
|
||||
},{
|
||||
name:'酒精性肝病',
|
||||
value:2
|
||||
},{
|
||||
name:'酒精性肝硬化',
|
||||
value:3
|
||||
},{
|
||||
name:'自身免疫性肝炎(AIH)',
|
||||
value:4
|
||||
},{
|
||||
name:'原发性胆汁性肝硬化(PBC)',
|
||||
value:5
|
||||
},{
|
||||
name:'原发性硬化性胆管炎(PSC)',
|
||||
value:6
|
||||
},{
|
||||
name:'非酒精性脂肪肝',
|
||||
value:7
|
||||
},{
|
||||
name:'药物性肝损伤',
|
||||
value:8
|
||||
},{
|
||||
name:'肝豆状核变性',
|
||||
value:9
|
||||
},{
|
||||
name:'甲肝',
|
||||
value:10
|
||||
},{
|
||||
name:'肝戊肝衰竭',
|
||||
value:11
|
||||
},{
|
||||
name:'其他',
|
||||
value:-1
|
||||
}]
|
||||
const ganneiOption=[
|
||||
{
|
||||
name:'乙肝再激活',
|
||||
value:0
|
||||
},{
|
||||
name:'大量饮酒',
|
||||
value:1
|
||||
},{
|
||||
name:'药物毒物',
|
||||
value:2
|
||||
},
|
||||
{
|
||||
name:'戊型肝炎感染',
|
||||
value:3
|
||||
},
|
||||
{
|
||||
name:'甲型肝炎感染',
|
||||
value:4
|
||||
},
|
||||
{
|
||||
name:'丙肝再激活',
|
||||
value:5
|
||||
},
|
||||
{
|
||||
name:'其他',
|
||||
value:-1
|
||||
}]
|
||||
const ganwaiOption=[
|
||||
{
|
||||
name:'消化道出血',
|
||||
value:0
|
||||
},{
|
||||
name:'感染',
|
||||
value:1
|
||||
},{
|
||||
name:'手术',
|
||||
value:2
|
||||
},
|
||||
{
|
||||
name:'劳累',
|
||||
value:3
|
||||
},
|
||||
{
|
||||
name:'其他',
|
||||
value:-1
|
||||
}]
|
||||
const moshiOption=[{
|
||||
name:'DPMAS',
|
||||
value:0
|
||||
},{
|
||||
name:'DPMAS+PE',
|
||||
value:1
|
||||
},{
|
||||
name:'DPMAS+其他',
|
||||
value:2
|
||||
},{
|
||||
name:'CA280吸附',
|
||||
value:3
|
||||
},{
|
||||
name:'DPCAS',
|
||||
value:4
|
||||
}]
|
||||
const kangningOption=[{
|
||||
name:'肝素',
|
||||
value:0
|
||||
},{
|
||||
name:'DPMAS+低分子肝素',
|
||||
value:1
|
||||
},{
|
||||
name:'枸橼酸',
|
||||
value:2
|
||||
},{
|
||||
name:'甲磺酸萘莫司他',
|
||||
value:3
|
||||
},{
|
||||
name:'其他',
|
||||
value:-1
|
||||
}]
|
||||
const hospitalOption=[{
|
||||
name:'好转',
|
||||
value:0
|
||||
},{
|
||||
name:'痊愈',
|
||||
value:1
|
||||
},{
|
||||
name:'恶化',
|
||||
value:2
|
||||
},{
|
||||
name:'死亡',
|
||||
value:3
|
||||
},{
|
||||
name:'移植',
|
||||
value:4
|
||||
}]
|
||||
module.exports = {
|
||||
diagnoseOption: diagnoseOption,
|
||||
patientSickOption: patientSickOption,
|
||||
ganneiOption: ganneiOption,
|
||||
ganwaiOption: ganwaiOption,
|
||||
moshiOption:moshiOption,
|
||||
kangningOption:kangningOption,
|
||||
hospitalOption:hospitalOption
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
externalClasses:['myclass'],
|
||||
externalClasses:['myclass','colorCalss'],
|
||||
properties: {
|
||||
navName: {
|
||||
type: String,
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<!--components/navBar.wxml-->
|
||||
<view class="ui-navigatorbar myclass" >
|
||||
<van-icon name="arrow-left" bindtap="goBack" class="ui-navigatorbar-back" />
|
||||
<view class="ui-title">{{name}}</view>
|
||||
<view class="ui-navigatorbar myclass colorCalss" >
|
||||
<van-icon name="arrow-left" bindtap="goBack"
|
||||
class="colorCalss"
|
||||
class="ui-navigatorbar-back" />
|
||||
<view class="ui-title colorCalss">{{name}}</view>
|
||||
</view>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* components/navBar.wxss */
|
||||
.ui-navigatorbar {
|
||||
position: fixed;
|
||||
z-index:99;
|
||||
|
||||
top: 0;
|
||||
width: 750rpx;
|
||||
height: 172rpx;
|
||||
|
||||
225
components/paintCanvas/paintCanvas.js
Normal file
225
components/paintCanvas/paintCanvas.js
Normal file
@ -0,0 +1,225 @@
|
||||
import utils from "../../utils/utils";
|
||||
// painting-2.js
|
||||
Component({
|
||||
properties: {
|
||||
showPaint:{
|
||||
type: Boolean,
|
||||
value:false,
|
||||
observer(newval) {
|
||||
this.setData({
|
||||
showPaint: newval
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ready(){
|
||||
let that = this;
|
||||
// 获取设备信息,canvas高度用
|
||||
wx.getSystemInfo({
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
that.setData({
|
||||
canvasWidth: res.windowWidth,
|
||||
canvasHeight: res.windowHeight-50,
|
||||
windowHeight: res.windowHeight
|
||||
})
|
||||
},
|
||||
})
|
||||
// 选照片
|
||||
//this.chooseImg();
|
||||
},
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
showPaint:false,
|
||||
hasChoosedImg: false,
|
||||
canvasWidth: 0,
|
||||
showBars: false,
|
||||
canvasHeight: 0, // canvas的完整高度
|
||||
canvasHeightLen: 0, // canvas的临时高度(用在操作栏影响画布高度时)
|
||||
windowHeight: 0, // 屏幕高度
|
||||
prevPosition: [0, 0], // 手指触摸的所在位置
|
||||
background: '', // 背景图片,即导入的图片
|
||||
colors: ["#FFFFFF", "#000000", "#ff0000", "#ffff00", "#00CC00", "#99CCFF", "#0000ff", "#ff00ff"],
|
||||
selectColor:"#99CCFF",
|
||||
btnInfo: [
|
||||
{
|
||||
type: 'width',
|
||||
background: 'url("http://ov8a2tdri.bkt.clouddn.com/wx-app/icon-1.png"); background-size: 30px 30px;'
|
||||
},
|
||||
{
|
||||
type: 'color',
|
||||
background: 'url("http://ov8a2tdri.bkt.clouddn.com/wx-app/icon-2.png") white no-repeat; background-size: 24px 24px;background-position: 3px 3px;'
|
||||
},
|
||||
{
|
||||
type: 'clear',
|
||||
background: 'url("http://img0.imgtn.bdimg.com/it/u=1358545290,3102156418&fm=26&gp=0.jpg") white no-repeat; background-size: 20px 20px;background-position: 5px 5px;'
|
||||
},
|
||||
{
|
||||
type: 'save',
|
||||
background: 'url("http://ov8a2tdri.bkt.clouddn.com/wx-app/icon-6.png") white no-repeat; background-size: 20px 20px;background-position: 5px 5px;'
|
||||
}
|
||||
],
|
||||
width: false, // 是否开启宽度调整栏
|
||||
color: false, // 是否开启颜色调整栏
|
||||
r: 33,
|
||||
g: 33,
|
||||
b: 33,
|
||||
selectSize:5,
|
||||
clear: false, // 是否开启清空栏
|
||||
eraser: false, // 是否开启橡皮擦
|
||||
saving: false, // 是否在保存状态
|
||||
scope: false, // 是否有保存图片的权限
|
||||
},
|
||||
methods:{
|
||||
hideTuya(){
|
||||
this.setData({
|
||||
showPaint:false,
|
||||
})
|
||||
},
|
||||
chooseBi(){
|
||||
this.setData({
|
||||
width: false, // 是否开启宽度调整栏
|
||||
color: false,
|
||||
clear: false, // 是否开启清空栏
|
||||
eraser: false, // 是否开启橡皮擦
|
||||
saving: false,
|
||||
})
|
||||
},
|
||||
// save(e){
|
||||
// saveImg(this, 2);
|
||||
// this.triggerEvent('confirmUpload')
|
||||
// },
|
||||
tapBtn: function (e) {
|
||||
utils.tapBtn(e, this, 2);
|
||||
},
|
||||
showBarsHandler(e) {
|
||||
//this.tapBtn(e)
|
||||
this.setData({
|
||||
showBars: !this.data.showBars,
|
||||
clear:false,
|
||||
eraser:false
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
sizeHandler(e) {
|
||||
const size = e.detail.value;
|
||||
this.setData({
|
||||
selectSize: size
|
||||
})
|
||||
},
|
||||
hideBarsHandler() {
|
||||
this.setData({
|
||||
showBars: false
|
||||
})
|
||||
},
|
||||
colorChange(e) {
|
||||
this.tapBtn(e);
|
||||
const color = e.currentTarget.dataset.color;
|
||||
this.setData({
|
||||
selectColor: color
|
||||
})
|
||||
},
|
||||
addImg: function (e) {
|
||||
this.chooseImg();
|
||||
},
|
||||
|
||||
chooseImg() {
|
||||
let that = this;
|
||||
wx.chooseImage({
|
||||
count:1,
|
||||
success: function (res) {
|
||||
that.setData({
|
||||
hasChoosedImg: true,
|
||||
})
|
||||
wx.getImageInfo({
|
||||
src: res.tempFilePaths[0],
|
||||
success: function (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
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
touchStart: function (e) {
|
||||
// 开始画图,隐藏所有的操作栏
|
||||
this.setData({
|
||||
prevPosition: [e.touches[0].x, e.touches[0].y],
|
||||
width: false,
|
||||
color: false,
|
||||
canvasHeightLen: 0
|
||||
})
|
||||
},
|
||||
|
||||
touchMove: function (e) {
|
||||
// 触摸移动,绘制中。。。
|
||||
let ctx = wx.createCanvasContext('myCanvas',this);
|
||||
|
||||
if (this.data.eraser) {
|
||||
ctx.clearRect(e.touches[0].x, e.touches[0].y, this.data.selectSize,this.data.selectSize);
|
||||
ctx.draw(true);
|
||||
} else {
|
||||
ctx.setStrokeStyle(this.data.selectColor);
|
||||
ctx.setLineWidth(this.data.selectSize);
|
||||
ctx.setLineCap('round');
|
||||
ctx.setLineJoin('round');
|
||||
ctx.moveTo(this.data.prevPosition[0], this.data.prevPosition[1]);
|
||||
ctx.lineTo(e.touches[0].x, e.touches[0].y);
|
||||
ctx.stroke();
|
||||
ctx.draw(true);
|
||||
}
|
||||
|
||||
this.setData({
|
||||
prevPosition: [e.touches[0].x, e.touches[0].y]
|
||||
})
|
||||
console.log(11111)
|
||||
},
|
||||
|
||||
clearCanvas: function (e) {
|
||||
this.tapBtn(e)
|
||||
let ctx = wx.createCanvasContext('myCanvas',this);
|
||||
ctx.clearRect(0, 0, this.data.canvasWidth, this.data.canvasHeight);
|
||||
ctx.draw();
|
||||
this.setData({
|
||||
clear: false,
|
||||
canvasHeightLen: 0
|
||||
});
|
||||
this.chooseBi();
|
||||
},
|
||||
|
||||
chooseEraser: function () {
|
||||
this.setData({
|
||||
eraser: true,
|
||||
clear: false,
|
||||
canvasHeightLen: 0
|
||||
})
|
||||
},
|
||||
|
||||
changeColor: function (e) {
|
||||
utils.changeColor(e, this);
|
||||
},
|
||||
|
||||
changeWidth: function (e) {
|
||||
utils.changeWidth(e, this, (this.data.canvasHeightLen + this.data.w - e.detail.value), 2);
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
7
components/paintCanvas/paintCanvas.json
Normal file
7
components/paintCanvas/paintCanvas.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-overlay": "@vant/weapp/overlay/index"
|
||||
}
|
||||
}
|
||||
73
components/paintCanvas/paintCanvas.wxml
Normal file
73
components/paintCanvas/paintCanvas.wxml
Normal file
@ -0,0 +1,73 @@
|
||||
<!--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="ui-navigatorbar myclass colorCalss" >
|
||||
<van-icon name="arrow-left" bindtap="hideTuya"
|
||||
color="#fff"
|
||||
class="ui-navigatorbar-back colorCalss" />
|
||||
<view class="ui-title colorCalss">涂鸦</view>
|
||||
</view> -->
|
||||
|
||||
<canvas canvas-id="myCanvas" disable-scroll="true" bindtouchstart="touchStart"
|
||||
bindtouchmove="touchMove" bindtouchend="touchEnd" wx:if="{{hasChoosedImg}}"
|
||||
style="margin:0 auto;height: {{(canvasHeightLen == 0) ? canvasHeight : canvasHeightLen}}px; width: {{canvasWidth}}px; background: url('{{background}}');background-position: 0 0; background-size: {{canvasWidth}}px {{canvasHeight}}px"
|
||||
/>
|
||||
<view class="failText" wx:if="{{!hasChoosedImg}}" bindtap="addImg" >没有选择照片,点击重新选择</view>
|
||||
<!-- <view class="bottom">
|
||||
<block wx:for="{{btnInfo}}" wx:key="{{index}}">
|
||||
<view class="list-item" data-type="{{item.type}}" style="background: {{item.background}}" bindtap="tapBtn"></view>
|
||||
</block>
|
||||
</view> -->
|
||||
<!-- <view class="choose-box" wx:if="{{width}}">
|
||||
<view class="color-box" style="background: {{'rgb(' + r + ', ' + g + ', ' + b + ')'}}; height: {{w}}px; border-radius: {{w/2}}px"></view>
|
||||
<slider min="1" max="50" step="1" show-value="true" value="{{w}}" bindchange="changeWidth"/>
|
||||
</view> -->
|
||||
<!-- <view class="choose-box" wx:if="{{color}}">
|
||||
<view class="color-box" style="background: {{'rgb(' + r + ', ' + g + ', ' + b + ')'}}; height: {{w}}px; border-radius: {{w/2}}px"></view>
|
||||
<slider min="0" max="255" step="1" show-value="true" activeColor="red" value="{{r}}" data-color="r" bindchange="changeColor"/>
|
||||
<slider min="0" max="255" step="1" show-value="true" activeColor="green" value="{{g}}" data-color="g" bindchange="changeColor"/>
|
||||
<slider min="0" max="255" step="1" show-value="true" activeColor="blue" value="{{b}}" data-color="b" bindchange="changeColor"/>
|
||||
</view> -->
|
||||
<!-- 涂鸦工具区 -->
|
||||
<view style="padding: 30rpx 32rpx 50rpx;position: fixed;bottom:0;width:100%;box-sizing: border-box;" >
|
||||
<view class="space" style="padding-bottom: 20rpx; color: #FFF; font-size: 30rpx; line-height: 56rpx;display: flex;width:100%">
|
||||
<view catch:tap="hideTuya">返回</view>
|
||||
<view style="width: 30rpx;"></view>
|
||||
<view catch:tap="tapBtn" data-type="save">确定</view>
|
||||
|
||||
<view style="flex: 1;"></view>
|
||||
<view catch:tap="chooseBi" >铅笔</view>
|
||||
<view style="width: 30rpx;"></view>
|
||||
<view catch:tap="showBarsHandler" data-type="width">笔触</view>
|
||||
<view style="width: 30rpx;"></view>
|
||||
<view catch:tap="chooseEraser" >橡皮擦</view>
|
||||
<view style="width: 30rpx;"></view>
|
||||
<view catch:tap="clearCanvas" data-type="clear">清除</view>
|
||||
</view>
|
||||
<scroll-view scroll-x style="height: 90rpx;">
|
||||
<view style="white-space: nowrap;">
|
||||
<block wx:for="{{colors}}" wx:key="index">
|
||||
<view style="background-color: {{item}};" class="colorBtn {{selectColor == item && 'select'}}" catch:tap="colorChange" data-color="{{item}}" data-type="color"></view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="bars {{showBars && 'show'}}" wx:if="{{showBars}}">
|
||||
<view class="space vertical_center">
|
||||
<view style="width: 136rpx;">字号:</view>
|
||||
<slider style="flex: 1;" value="{{selectSize}}" step="1" min="1" max="20" block-size="12" activeColor="#a88cf8" bindchanging="sizeHandler" />
|
||||
<view style="width: 50rpx; text-align: right;">{{selectSize}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="choose-box-flex" wx:if="{{clear}}">
|
||||
<view class="choose-item" bindtap="chooseEraser">
|
||||
<view class="choose-img" style='background: url("http://ov8a2tdri.bkt.clouddn.com/wx-app/icon-5.png") white no-repeat; background-size: 26px 26px;background-position: 2px 2px; border: {{eraser ? "2px solid #888" : "2px solid transparent"}}'></view>
|
||||
<view>橡皮擦</view>
|
||||
</view>
|
||||
<view class="choose-item" bindtap="clearCanvas">
|
||||
<view class="choose-img" style='background: url("http://ov8a2tdri.bkt.clouddn.com/wx-app/icon-4.png") white no-repeat; background-size: 26px 26px;background-position: 2px 2px;'></view>
|
||||
<view>清空</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</van-overlay>
|
||||
150
components/paintCanvas/paintCanvas.wxss
Normal file
150
components/paintCanvas/paintCanvas.wxss
Normal file
@ -0,0 +1,150 @@
|
||||
/* case/pages/paintCanvas/paintCanvas.wxss *//* painting-2.wxss */
|
||||
page {
|
||||
background: rgba(153, 204, 255, 0.1);
|
||||
}
|
||||
.myclass{
|
||||
background-color: #000!important;
|
||||
}
|
||||
.colorCalss{
|
||||
color:#fff!important;
|
||||
}
|
||||
.ui-navigatorbar {
|
||||
position: fixed;
|
||||
top:0;
|
||||
z-index:99999;
|
||||
width: 750rpx;
|
||||
height: 172rpx;
|
||||
background: #FFFFFF;
|
||||
backdrop-filter: blur(20px);
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.ui-navigatorbar-back {
|
||||
position: absolute;
|
||||
padding-left:40rpx;
|
||||
padding-right:40rpx;
|
||||
|
||||
left: 0rpx;
|
||||
font-size: 40rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
||||
.ui-title {
|
||||
position: absolute;
|
||||
width: 350rpx;
|
||||
height: 88rpx;
|
||||
line-height: 56rpx;
|
||||
font-size: 36rpx;
|
||||
white-space: nowrap;
|
||||
color: #000000;
|
||||
bottom: 0;
|
||||
left: 200rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.upage {
|
||||
position: relative;
|
||||
z-index:999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.failText {
|
||||
margin-top: 200rpx;
|
||||
text-align: center;
|
||||
color: #888;
|
||||
}
|
||||
.colorBtn {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 20rpx;
|
||||
display: inline-block;
|
||||
border: 6rpx solid #242424;
|
||||
}
|
||||
|
||||
.colorBtn.select {
|
||||
border: 6rpx solid #FFF;
|
||||
}
|
||||
|
||||
.bars {
|
||||
right: 1rem;
|
||||
width: 400rpx;
|
||||
padding: 20rpx;
|
||||
bottom: 7.5rem;
|
||||
color: #a88cf8;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
border-radius: 8rpx;
|
||||
background-color: #242424;
|
||||
box-shadow: 0 0 1.5rem 0 #FFFFFF20;
|
||||
}
|
||||
|
||||
slider {
|
||||
margin: 20rpx 20rpx 20rpx 0 !important;
|
||||
}
|
||||
|
||||
.flex_column {
|
||||
display: flex;
|
||||
flex-direction: column !important;
|
||||
}
|
||||
|
||||
.vertical_center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.space {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
text-shadow: 2px 2px 1px #000000;
|
||||
}
|
||||
.bottom {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin: 20rpx 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.choose-box {
|
||||
width: 750rpx;
|
||||
position: absolute;
|
||||
bottom: 100rpx;
|
||||
}
|
||||
|
||||
.color-box {
|
||||
width: 375rpx;
|
||||
margin: 40rpx auto;
|
||||
}
|
||||
|
||||
slider {
|
||||
margin: 40rpx 60rpx;
|
||||
}
|
||||
|
||||
.choose-box-flex {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
width: 750rpx;
|
||||
position: absolute;
|
||||
bottom: 100rpx;
|
||||
font-size: 32rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
.choose-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
background: white;
|
||||
}
|
||||
230
utils/utils.js
Normal file
230
utils/utils.js
Normal file
@ -0,0 +1,230 @@
|
||||
function formatTime(date) {
|
||||
var year = date.getFullYear()
|
||||
var month = date.getMonth() + 1
|
||||
var day = date.getDate()
|
||||
|
||||
var hour = date.getHours()
|
||||
var minute = date.getMinutes()
|
||||
var second = date.getSeconds()
|
||||
|
||||
|
||||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
function formatNumber(n) {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
// 公用的修改颜色
|
||||
function changeColor(e, _this) {
|
||||
let tempData = {};
|
||||
tempData[e.target.dataset.color] = e.detail.value;
|
||||
_this.setData({
|
||||
...tempData,
|
||||
eraser: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 公用的修改画笔宽度
|
||||
function changeWidth(e, _this, canvasHeight, pageType) {
|
||||
let c = {};
|
||||
if (pageType === 1) {
|
||||
c.canvasHeight = canvasHeight;
|
||||
} else {
|
||||
c.canvasHeightLen = canvasHeight;
|
||||
}
|
||||
_this.setData({
|
||||
w: e.detail.value,
|
||||
eraser: false,
|
||||
...c,
|
||||
})
|
||||
}
|
||||
|
||||
// 点击按钮触发的事件
|
||||
function tapBtn(e, _this, pageType) {
|
||||
let btnType = e.target.dataset.type;
|
||||
|
||||
let c = {};
|
||||
|
||||
switch (btnType) {
|
||||
// 画笔宽度
|
||||
case 'width':
|
||||
if (pageType === 1) {
|
||||
c.canvasHeight = (!_this.data.width) ? 130 + _this.data.w : 50
|
||||
} else if (pageType === 2) {
|
||||
c.canvasHeightLen = (!_this.data.width) ? Math.min(_this.data.canvasHeight, _this.data.windowHeight - _this.data.w - 130) : 0;
|
||||
} else if (pageType === 3) {
|
||||
c.canvasHeight = 130;
|
||||
}
|
||||
_this.setData({
|
||||
width: !_this.data.width,
|
||||
color: false,
|
||||
clear: false,
|
||||
...c,
|
||||
});
|
||||
return;
|
||||
// 画笔颜色
|
||||
case 'color':
|
||||
if (pageType === 1) {
|
||||
c.canvasHeight = (!_this.data.color) ? 205 + _this.data.w : 50;
|
||||
} else if (pageType === 2) {
|
||||
c.canvasHeightLen = (!_this.data.color) ? Math.min(_this.data.canvasHeight, _this.data.windowHeight - _this.data.w - 205) : 0;
|
||||
}
|
||||
_this.setData({
|
||||
width: false,
|
||||
color: !_this.data.color,
|
||||
clear: false,
|
||||
...c,
|
||||
});
|
||||
return;
|
||||
// 清空按钮
|
||||
case 'clear':
|
||||
if (pageType === 1) {
|
||||
c.canvasHeight = (!_this.data.clear) ? 120 + _this.data.w : 50;
|
||||
} else if (pageType === 2) {
|
||||
c.canvasHeightLen = (!_this.data.clear) ? Math.min(_this.data.canvasHeight, _this.data.windowHeight - _this.data.w - 120) : 0;
|
||||
}
|
||||
_this.setData({
|
||||
width: false,
|
||||
color: false,
|
||||
clear: !_this.data.clear,
|
||||
...c,
|
||||
})
|
||||
return;
|
||||
// 保存
|
||||
case 'save':
|
||||
saveImg(_this, pageType);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function saveImg(_this, pageType) {
|
||||
let c = {};
|
||||
if (pageType === 1) {
|
||||
c.canvasHeight = 50;
|
||||
} else if (pageType === 2) {
|
||||
c.canvasHeightLen = 0;
|
||||
}
|
||||
console.log(_this)
|
||||
// 查看授权
|
||||
// if (!_this.data.scope) {
|
||||
// wx.showModal({
|
||||
// title: '需要授权',
|
||||
// content: '保存图片需要获取您的授权',
|
||||
// success: (res) => {
|
||||
// if (res.confirm) {
|
||||
// wx.openSetting({
|
||||
// success: (res) => {
|
||||
// if (res.authSetting['scope.writePhotosAlbum']) {
|
||||
// _this.setData({
|
||||
// scope: true,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// 已经获得授权且不在保存中
|
||||
//if (_this.data.scope && !_this.data.saving) {
|
||||
// wx.showLoading({
|
||||
// title: '保存中',
|
||||
// mask: true,
|
||||
// })
|
||||
// 关闭所有的操作栏
|
||||
_this.setData({
|
||||
width: false,
|
||||
color: false,
|
||||
clear: false,
|
||||
saving: true,
|
||||
...c,
|
||||
})
|
||||
|
||||
if (pageType === 2) {
|
||||
/*
|
||||
* 对于涂鸦照片,一共分为四步:
|
||||
* 1、将画的内容先保存出来
|
||||
* 2、然后再将照片先画在canvas上
|
||||
* 3、将画的内容覆盖的画在canvas上
|
||||
* 4、最终保存
|
||||
*/
|
||||
wx.canvasToTempFilePath({
|
||||
canvasId: 'myCanvas',
|
||||
success: function (res) {
|
||||
// 把单纯用户画的内容存好了
|
||||
let src = res.tempFilePath;
|
||||
let ctx = wx.createCanvasContext('myCanvas',_this);
|
||||
// 照片
|
||||
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();
|
||||
|
||||
_canvaseSaveToImg(_this);
|
||||
}
|
||||
},_this);
|
||||
} else {
|
||||
_canvaseSaveToImg(_this);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
function _canvaseSaveToImg(_this) {
|
||||
// 调用微信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
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: function (res) {
|
||||
// canvas转图片失败
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
icon: 'loading',
|
||||
title: '失败',
|
||||
})
|
||||
}
|
||||
},_this)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime: formatTime,
|
||||
changeColor: changeColor,
|
||||
changeWidth: changeWidth,
|
||||
tapBtn: tapBtn,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user