Browse Source

病例联调

main
kola-web 7 months ago
parent
commit
44caf73499
  1. 38
      src/components/customAudioBar/index.ts
  2. 15
      src/components/customRecord/index.ts
  3. 43
      src/components/uploadFile/index.ts
  4. 3
      src/components/uploadFile/index.wxml
  5. BIN
      src/images/icon-file.png
  6. BIN
      src/images/icon-file1.png
  7. BIN
      src/images/icon-file2.png
  8. BIN
      src/images/icon-file3.png
  9. BIN
      src/images/icon-file4.png
  10. 20
      src/module1/pages/entryCases/index.scss
  11. 37
      src/module1/pages/entryCases/index.ts
  12. 25
      src/module1/pages/entryCases/index.wxml

38
src/components/customAudioBar/index.ts

@ -1,4 +1,4 @@
const _app = getApp<IAppOption>() const _app = getApp<IAppOption>();
// pages/story/a.ts // pages/story/a.ts
Component({ Component({
@ -8,12 +8,12 @@ Component({
properties: { properties: {
url: { url: {
type: String, type: String,
value: value: "",
'https://circlehbsaas.oss-cn-beijing.aliyuncs.com/audio/20240907757_tmp_acf4f18c59553a8d2d9f74e173a16328.m4a.mp3', // 'https://circlehbsaas.oss-cn-beijing.aliyuncs.com/audio/20240907757_tmp_acf4f18c59553a8d2d9f74e173a16328.m4a.mp3',
}, },
time: { time: {
type: String, type: String,
value: '', value: "",
}, },
}, },
@ -29,7 +29,7 @@ Component({
attached() { attached() {
this.setData({ this.setData({
innerAudioContext: wx.createInnerAudioContext(), innerAudioContext: wx.createInnerAudioContext(),
}) });
}, },
}, },
@ -38,33 +38,35 @@ Component({
*/ */
methods: { methods: {
handlePlay() { handlePlay() {
const { url, play, innerAudioContext } = this.data const { url, play, innerAudioContext } = this.data;
if (innerAudioContext) { if (innerAudioContext) {
if (play) { if (play) {
innerAudioContext.stop() innerAudioContext.stop();
return return;
} }
innerAudioContext.stop() innerAudioContext.stop();
innerAudioContext.src = url innerAudioContext.src = url;
innerAudioContext.play() innerAudioContext.play();
this.setData({ this.setData({
play: true, play: true,
}) });
innerAudioContext.onEnded(() => { innerAudioContext.onEnded(() => {
this.setData({ this.setData({
play: false, play: false,
}) });
}) });
} }
}, },
handlePause() { handlePause() {
const { innerAudioContext } = this.data const { innerAudioContext } = this.data;
if (innerAudioContext) { if (innerAudioContext) {
innerAudioContext.pause() innerAudioContext.pause();
this.setData({ this.setData({
play: false, play: false,
}) });
} }
}, },
}, },
}) });
export {};

15
src/components/customRecord/index.ts

@ -55,13 +55,10 @@ Component({
}); });
}, },
recorderManagerListen(recorderManager: WechatMiniprogram.RecorderManager) { recorderManagerListen(recorderManager: WechatMiniprogram.RecorderManager) {
recorderManager.onError(() => {
wx.showToast({
title: "录音失败",
icon: "none",
});
});
recorderManager.onStart(() => { recorderManager.onStart(() => {
this.setData({
time: 0,
});
this.handleTiem(); this.handleTiem();
}); });
recorderManager.onStop((res) => { recorderManager.onStop((res) => {
@ -155,7 +152,7 @@ Component({
suffix: this.GetExtensionFileName(data.data.Url), suffix: this.GetExtensionFileName(data.data.Url),
type: item.fileType, type: item.fileType,
imgUrl: "", imgUrl: "",
duration: "", duration: 0,
}; };
if (item.fileType === "image") { if (item.fileType === "image") {
expandJson.imgUrl = data.data.Url; expandJson.imgUrl = data.data.Url;
@ -164,7 +161,7 @@ Component({
expandJson.imgUrl = data.data.SnapshotUrl; expandJson.imgUrl = data.data.SnapshotUrl;
} }
if (item.fileType === "audio") { if (item.fileType === "audio") {
expandJson.duration = item.duration; expandJson.duration = Number.parseInt(String(item.duration / 1000));
} }
resolve(expandJson); resolve(expandJson);
}, },
@ -185,3 +182,5 @@ Component({
}, },
}, },
}); });
export {};

43
src/components/uploadFile/index.ts

@ -10,6 +10,10 @@ Component({
type: Boolean, type: Boolean,
value: false, value: false,
}, },
chooseMessage: {
type: Boolean,
value: false,
},
accept: { accept: {
type: String, type: String,
value: "image", value: "image",
@ -23,7 +27,16 @@ Component({
/** /**
* *
*/ */
data: {}, data: {
fileTypeList: {
doc: 5,
docx: 5,
pdf: 4,
xls: 6,
xlsx: 6,
ppt: 7,
},
},
/** /**
* *
@ -41,8 +54,11 @@ Component({
if (this.data.obscure) { if (this.data.obscure) {
wx.editImage({ wx.editImage({
src: e.detail.file.url || e.detail.file.tempFilePath, src: e.detail.file.url || e.detail.file.tempFilePath,
success: (res:any) => { success: (res: any) => {
this.uploadFile(res.detail.file).then((res) => { this.uploadFile({
...e.detail.file,
tempFilePath: res.tempFilePath,
}).then((res) => {
this.triggerEvent("file", res as object); this.triggerEvent("file", res as object);
}); });
}, },
@ -62,6 +78,27 @@ Component({
this.triggerEvent("file", res as object); this.triggerEvent("file", res as object);
}); });
}, },
handleChooseFile() {
wx.chooseMessageFile({
type: "file",
count: 1,
success: (res) => {
this.uploadFile({
...res.tempFiles[0],
fileType: res.tempFiles[0].type,
tempFilePath: res.tempFiles[0].path,
}).then((res) => {
this.triggerEvent("file", res as object);
});
},
fail() {
wx.showToast({
icon: "none",
title: "取消选择",
});
},
});
},
uploadFile(item) { uploadFile(item) {
wx.showLoading({ wx.showLoading({
title: "正在上传", title: "正在上传",

3
src/components/uploadFile/index.wxml

@ -1,6 +1,9 @@
<button class="button" wx:if="{{chooseAvatar}}" open-type="chooseAvatar" bindchooseavatar="handleChooseAvatar"> <button class="button" wx:if="{{chooseAvatar}}" open-type="chooseAvatar" bindchooseavatar="handleChooseAvatar">
<slot></slot> <slot></slot>
</button> </button>
<button class="button" wx:elif="{{chooseMessage}}" bind:tap="handleChooseFile">
<slot></slot>
</button>
<van-uploader wx:else accept="{{accept}}" max-count="{{1}}" bind:after-read="handleAfterRead"> <van-uploader wx:else accept="{{accept}}" max-count="{{1}}" bind:after-read="handleAfterRead">
<slot></slot> <slot></slot>
</van-uploader> </van-uploader>

BIN
src/images/icon-file.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
src/images/icon-file1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/images/icon-file2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/images/icon-file3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/images/icon-file4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

20
src/module1/pages/entryCases/index.scss

@ -15,8 +15,10 @@ page {
.limit { .limit {
color: rgba(153, 153, 153, 1); color: rgba(153, 153, 153, 1);
} }
.message-select { .message-select-wrap {
float: right; float: right;
}
.message-select {
padding: 8rpx 24rpx; padding: 8rpx 24rpx;
font-size: 28rpx; font-size: 28rpx;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
@ -27,7 +29,7 @@ page {
&.required { &.required {
&::before { &::before {
display: inline; display: inline;
content: '*'; content: "*";
color: rgba(255, 87, 51, 1); color: rgba(255, 87, 51, 1);
} }
} }
@ -118,6 +120,7 @@ page {
.audio-list { .audio-list {
margin-top: 32rpx; margin-top: 32rpx;
.row { .row {
margin-bottom: 24rpx;
display: flex; display: flex;
gap: 28rpx; gap: 28rpx;
align-items: center; align-items: center;
@ -131,7 +134,7 @@ page {
gap: 20rpx; gap: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.del{ .del {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
} }
@ -192,13 +195,19 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
.icon { .icon {
flex-shrink: 0;
width: 56rpx; width: 56rpx;
height: 56rpx; height: 56rpx;
} }
.name { .name {
flex: 1;
margin-left: 30rpx; margin-left: 30rpx;
font-size: 32rpx; font-size: 32rpx;
color: rgba(128, 128, 128, 1); color: rgba(128, 128, 128, 1);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 10em;
} }
} }
.option { .option {
@ -389,17 +398,16 @@ page {
} }
} }
.popup3 { .popup3 {
position: relative; position: relative;
width: 580rpx; width: 580rpx;
height: 590rpx; height: 590rpx;
box-sizing: border-box; box-sizing: border-box;
.bg{ .bg {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.sure{ .sure {
position: absolute; position: absolute;
width: 100%; width: 100%;
bottom: 40rpx; bottom: 40rpx;

37
src/module1/pages/entryCases/index.ts

@ -9,22 +9,9 @@ Page({
images: [] as any, images: [] as any,
description: "", description: "",
audios: [] as any, audios: [] as any,
files: [] as any,
}, },
onLoad() {}, onLoad() {},
handleChooseFile() {
wx.chooseMessageFile({
count: 1,
success(res) {
console.log(res);
},
fail() {
wx.showToast({
icon: "none",
title: "取消选择",
});
},
});
},
handleSubmit() { handleSubmit() {
wx.navigateTo({ wx.navigateTo({
url: "/module1/pages/entryCasesResult/index", url: "/module1/pages/entryCasesResult/index",
@ -63,4 +50,26 @@ Page({
], ],
}); });
}, },
handleDelAudio(e) {
const { index } = e.currentTarget.dataset;
this.setData({
audios: this.data.audios.filter((_, i) => i !== Number(index)),
});
},
handleFile(e) {
this.setData({
files: [
...this.data.files,
{
fileType: 99,
name: e.detail.name,
url: e.detail.fileUrl,
size: e.detail.size,
isRepeat: 2,
},
],
});
},
}); });
export {};

25
src/module1/pages/entryCases/index.wxml

@ -39,7 +39,12 @@
<view class="row" wx:for="{{audios}}" wx:key="index"> <view class="row" wx:for="{{audios}}" wx:key="index">
<customAudioBar class="audio-bar" url="{{item.url}}" time="{{item.duration}}"></customAudioBar> <customAudioBar class="audio-bar" url="{{item.url}}" time="{{item.duration}}"></customAudioBar>
<view class="options"> <view class="options">
<image class="del" src="{{imageUrl}}icon-del.png?t={{Timestamp}}"></image> <image
class="del"
src="{{imageUrl}}icon-del.png?t={{Timestamp}}"
bind:tap="handleDelAudio"
data-index="{{index}}"
></image>
<view class="trans">转文字</view> <view class="trans">转文字</view>
</view> </view>
</view> </view>
@ -52,17 +57,15 @@
<view class="card"> <view class="card">
<view class="card-title"> <view class="card-title">
病历相关文件 病历相关文件
<view class="message-select" bind:tap="handleChooseFile">从聊天记录选择文件</view> <uploadFile class="message-select-wrap" chooseMessage bind:file="handleFile">
</view> <view class="message-select">从聊天记录选择文件</view>
<view class="none-file"> </uploadFile>
<image class="nf-icon" src="{{imageUrl}}icon-nore-file.png?t={{Timestamp}}"></image>
<view class="nf-title">还没有文件哦!</view>
</view> </view>
<view class="file-list"> <view class="file-list" wx:if="{{files.length}}">
<view class="fl-row"> <view class="fl-row" wx:for="{{files}}">
<view class="wrap"> <view class="wrap">
<image class="icon" src="{{imageUrl}}icon-file.png?t={{Timestamp}}"></image> <image class="icon" src="{{imageUrl}}icon-file.png?t={{Timestamp}}"></image>
<view class="name">基因检测报告.pdf</view> <view class="name">{{item.name}}</view>
</view> </view>
<view class="option"> <view class="option">
<image class="icon" src="{{imageUrl}}icon-del.png?t={{Timestamp}}"></image> <image class="icon" src="{{imageUrl}}icon-del.png?t={{Timestamp}}"></image>
@ -71,6 +74,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="none-file" wx:else>
<image class="nf-icon" src="{{imageUrl}}icon-nore-file.png?t={{Timestamp}}"></image>
<view class="nf-title">还没有文件哦!</view>
</view>
</view> </view>
<view class="tags"> <view class="tags">
<view class="label">标签</view> <view class="label">标签</view>

Loading…
Cancel
Save