This commit is contained in:
zoujiandong
2025-06-10 17:40:29 +08:00
parent db955ff4f3
commit e25eb25063
11 changed files with 1341 additions and 675 deletions
+206 -177
View File
@@ -17,74 +17,18 @@
</view>
</view>
<view class="textcon">
<view class="textcell">
<view class="title">患者信息</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入患者信息"
></up--textarea>
</view>
</view>
<view class="textcell">
<view class="title">主诉</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入主诉"
></up--textarea>
</view>
</view>
<view class="textcell">
<view class="title">现病史及既往史</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入现病史及既往史"
></up--textarea>
</view>
</view>
<view class="textcell">
<view class="title">检查</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入检查内容"
></up--textarea>
</view>
</view>
<view class="textcell">
<view class="title">临床诊断</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入临床诊断"
></up--textarea>
</view>
</view>
<view class="textcell">
<view class="title">治疗经过及结果</view>
<view class="iptbox">
<up--textarea
maxlength="-1"
autoHeight
v-model="form.title"
placeholder="请输入治疗经过及结果"
></up--textarea>
</view>
</view>
<editor
id="editor"
placeholder="写点什么吧~~"
show-img-resize
show-img-toolbar
show-img-size
@ready="onEditorReady"
@focus="OnFocus"
@statuschange="statuschange"
></editor>
</view>
<view class="textcon">
<view class="textcon" style="border: none;">
<view class="row">
<view class="left">
总结与讨论 <text class="tip">(可不填)</text>
@@ -101,7 +45,7 @@
</view>
</view>
</view>
<view class="textcon">
<view class="textcon" >
<view class="sickbox">
<view class="sick">
治疗经过及结果
@@ -114,87 +58,8 @@
添加疾病
</view>
</view>
<view class="toolbox">
<view class="cell">
<u-upload
:fileList="imgList"
@afterRead="afterRead"
@delete="deletePic"
name="imgupload"
multiple
:maxCount="1"
width="32rpx"
height="32rpx"
>
<view class="cell">
<up--image
:src="photoImg"
class="headImg"
width="32rpx"
height="32rpx"
></up--image>
<view class="name">添加图片</view>
</view>
</u-upload>
</view>
<view class="cell">
<u-upload
:fileList="videoList"
@afterRead="afterRead"
accept="video"
name="videoupload"
multiple
maxDuration="3600"
:maxCount="1"
width="32rpx"
height="32rpx"
>
<view class="cell">
<up--image
:src="videoImg"
class="headImg"
width="32rpx"
height="32rpx"
></up--image>
<view class="name">添加视频</view>
</view>
</u-upload>
</view>
<view class="cell">
<up--image
:src="addImg"
class="headImg"
width="32rpx"
height="32rpx"
></up--image>
<view class="name">添加小标题</view>
</view>
</view>
<view class="imgbox">
<view class="imgunit">
<up--image
src="https://cdn.uviewui.com/uview/album/1.jpg"
radius="6"
width="150rpx"
height="150rpx"
@click="previewImg"
></up--image>
<view class="close">
<up-icon name="close-circle" color="#666" size="18"></up-icon>
</view>
</view>
</view>
<view class="imgbox">
<view class="close">
<up-icon name="close-circle" color="red" size="30"></up-icon>
</view>
<video
class="myVideo"
src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
@error="videoErrorCallback"
controls
></video>
</view>
<view class="textcell" v-if="showMinTitle">
<view class="titlebox">
<view class="title">小标题</view>
@@ -218,7 +83,42 @@
</view>
</view>
<view class="bottom">
<view class="left">
<view class="toolbox">
<view class="cell">
<view class="cell">
<up--image
:src="photoImg"
class="headImg"
width="32rpx"
height="32rpx"
@click="insertImage"
></up--image>
<view class="name">添加图片</view>
</view>
</view>
<view class="cell">
<view class="cell">
<up--image
:src="videoImg"
class="headImg"
width="32rpx"
height="32rpx"
></up--image>
<view class="name">添加视频</view>
</view>
</view>
<view class="cell">
<up--image
:src="addImg"
class="headImg"
width="32rpx"
height="32rpx"
></up--image>
<view class="name">添加小标题</view>
</view>
</view>
<view class="bottombtn">
<view class="left">
<view class="draft">存草稿</view>
<view class="vote">
投票
@@ -231,6 +131,7 @@
</view>
</view>
<view class="right">发布</view>
</view>
</view>
<up-popup
@@ -345,7 +246,6 @@
</up-popup>
</div>
</template>
<script setup>
import { reactive, ref } from "vue";
import backNav from "@/components/backNav/backNav";
@@ -353,14 +253,42 @@ import photoImg from "@/static/photo.png";
import addImg from "@/static/add.png";
import videoImg from "@/static/videoicon.png";
import voteImg from "@/static/vote.png";
import api from "@/api/api";
import dayjs from "dayjs";
import actionSheet from "uview-plus/components/u-action-sheet/actionSheet";
const form = reactive({
title: "",
exchange_title: "",
exchange_content:'',
exchange_summary:'',
case_exchange_vote:{
vote_title:'',
valid_day:null,
case_exchange_vote_option:[],
},
case_exchange_label:[],
case_exchange_img:[],
case_exchange_video:[]
});
const value = ref("");
const showVote = ref(false);
const showDraft = ref(true);
const showDraft = ref(false);
const showMinTitle = ref(false);
const draftList=ref([]);
const imgList = ref([]);
const videoList = ref([]);
const editorCtx = ref(null);
const onEditorReady=()=>{
uni.createSelectorQuery().select('#editor').context((res) => {
editorCtx.value = res.context;
editorCtx.value.setContents({
html:'<p>【患者信息】:</p><br/><br/><p>【主诉】:</p><br/><br/><p>【现病史及既往史】:</p><br/><br/><p>【检查】:</p><br/><br/><p>【临床诊断】:</p><br/><br/><p>【治疗经过及结果】:</p><br/><br/>'
});
}).exec()
}
const closeVote = () => {
showVote.value = false;
};
@@ -376,7 +304,99 @@ const delTitle = () => {
const openDraft = () => {
showDraft.value = true;
};
const afterRead=(file) => {
const pFun=(files)=>{
let promiseFun = [];
for(let i=0;i<files.length;i++){
promiseFun.push(handleUpload(files[i]));
}
Promise.all(promiseFun).then((res)=>{
uni.showToast({
title: "图片上传成功",
icon: "none",
duration: 1000
})
})
}
const addExchange=()=>{
api.addExchange(form).then(res=>{
uni.showToast({
title: "发布成功",
icon: "none",
duration: 2000
})
})
};
const handleUpload = (file) => {
api.getOss({
scene: 1,
})
.then((rep) => {
let result = rep.data;
if (result.code == 200) {
let { access_id, dir, policy, signature, host } = result.data;
let time = dayjs().format("YYYYMMDDHHmmss");
let random = generateRandomNumber();
let filename = time + random;
let imgType ="."+getImageFormat(file);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: host, // 仅为示例,非真实的接口地址
filePath: file,
name: "file",
formData: {
OSSAccessKeyId: access_id,
policy,
key: dir + time + random + imgType,
signature,
},
success(res) {
if (res.statusCode === 204) {
let url = host + "/" + dir + filename + imgType;
editorCtx.value.insertImage({
src: url
});
//imgList.value=[url]
}
},
fail: (err) => {
console.log(err);
},
});
});
}
});
};
const generateRandomNumber = () => {
let randomNumber = Math.floor(1000 + Math.random() * 9000);
return randomNumber;
};
const getImageFormat=(imageUrl)=>{
const lastDotIndex = imageUrl.lastIndexOf('.');
if (lastDotIndex !== -1) {
return imageUrl.substring(lastDotIndex + 1);
}
return 'unknown';
};
const insertImage=(file) => {
uni.chooseImage({
count: 9, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
extension:['jpg','png','jpeg'],
success: function (res) {
pFun(res.tempFilePaths)
}
});
}
const getList=()=>{
actionSheet.getDraftList().then(res=>{
draftList.value=res.data.data;
})
}
const previewImg = () => {
uni.previewImage({
@@ -387,6 +407,10 @@ const previewImg = () => {
</script>
<style lang='scss' scoped>
#editor{
padding:0 30rpx;
height:calc(100vh - 600rpx);
}
.myVideo {
width: 100%;
border-radius: 15rpx;
@@ -619,18 +643,39 @@ const previewImg = () => {
display: flex;
flex-direction: column;
height: 100vh;
:deep(.u-image) {
background: transparent !important;
}
}
.toolbox {
border-top: 2rpx solid #f3f4f6;
padding: 22rpx 30rpx;
display: flex;
align-items: center;
.cell {
margin-right: 20rpx;
display: flex;
align-items: center;
.name {
font-size: 25rpx;
margin-left: 4rpx;
color: #4b5563;
}
}
}
.bottom {
position: fixed;
bottom: 0;
border-top: 2rpx solid #e5e7eb;
width: 100%;
align-items: center;
z-index: 3;
height: 133rpx;
background: #ffffff;
display: flex;
.bottombtn{
display: flex;
align-items: center;
border-top: 2rpx solid #e5e7eb;
height: 133rpx;
}
.right {
margin-right: 30rpx;
@@ -675,24 +720,8 @@ const previewImg = () => {
height: calc(100vh - 133rpx);
margin: -20rpx 0rpx 134rpx;
overflow-y: scroll;
:deep(.u-image) {
background: transparent !important;
}
.toolbox {
padding: 22rpx 30rpx;
display: flex;
align-items: center;
.cell {
margin-right: 20rpx;
display: flex;
align-items: center;
.name {
font-size: 25rpx;
margin-left: 4rpx;
color: #4b5563;
}
}
}
.sickbox {
display: flex;
padding: 25rpx 25rpx 0;