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

15
src/components/customRecord/index.ts

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

41
src/components/uploadFile/index.ts

@ -10,6 +10,10 @@ Component({ @@ -10,6 +10,10 @@ Component({
type: Boolean,
value: false,
},
chooseMessage: {
type: Boolean,
value: false,
},
accept: {
type: String,
value: "image",
@ -23,7 +27,16 @@ Component({ @@ -23,7 +27,16 @@ Component({
/**
*
*/
data: {},
data: {
fileTypeList: {
doc: 5,
docx: 5,
pdf: 4,
xls: 6,
xlsx: 6,
ppt: 7,
},
},
/**
*
@ -42,7 +55,10 @@ Component({ @@ -42,7 +55,10 @@ Component({
wx.editImage({
src: e.detail.file.url || e.detail.file.tempFilePath,
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);
});
},
@ -62,6 +78,27 @@ Component({ @@ -62,6 +78,27 @@ Component({
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) {
wx.showLoading({
title: "正在上传",

3
src/components/uploadFile/index.wxml

@ -1,6 +1,9 @@ @@ -1,6 +1,9 @@
<button class="button" wx:if="{{chooseAvatar}}" open-type="chooseAvatar" bindchooseavatar="handleChooseAvatar">
<slot></slot>
</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">
<slot></slot>
</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

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

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

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

@ -9,22 +9,9 @@ Page({ @@ -9,22 +9,9 @@ Page({
images: [] as any,
description: "",
audios: [] as any,
files: [] as any,
},
onLoad() {},
handleChooseFile() {
wx.chooseMessageFile({
count: 1,
success(res) {
console.log(res);
},
fail() {
wx.showToast({
icon: "none",
title: "取消选择",
});
},
});
},
handleSubmit() {
wx.navigateTo({
url: "/module1/pages/entryCasesResult/index",
@ -63,4 +50,26 @@ Page({ @@ -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 @@ @@ -39,7 +39,12 @@
<view class="row" wx:for="{{audios}}" wx:key="index">
<customAudioBar class="audio-bar" url="{{item.url}}" time="{{item.duration}}"></customAudioBar>
<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>
</view>
@ -52,17 +57,15 @@ @@ -52,17 +57,15 @@
<view class="card">
<view class="card-title">
病历相关文件
<view class="message-select" bind:tap="handleChooseFile">从聊天记录选择文件</view>
</view>
<view class="none-file">
<image class="nf-icon" src="{{imageUrl}}icon-nore-file.png?t={{Timestamp}}"></image>
<view class="nf-title">还没有文件哦!</view>
<uploadFile class="message-select-wrap" chooseMessage bind:file="handleFile">
<view class="message-select">从聊天记录选择文件</view>
</uploadFile>
</view>
<view class="file-list">
<view class="fl-row">
<view class="file-list" wx:if="{{files.length}}">
<view class="fl-row" wx:for="{{files}}">
<view class="wrap">
<image class="icon" src="{{imageUrl}}icon-file.png?t={{Timestamp}}"></image>
<view class="name">基因检测报告.pdf</view>
<view class="name">{{item.name}}</view>
</view>
<view class="option">
<image class="icon" src="{{imageUrl}}icon-del.png?t={{Timestamp}}"></image>
@ -71,6 +74,10 @@ @@ -71,6 +74,10 @@
</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 class="tags">
<view class="label">标签</view>

Loading…
Cancel
Save