diff --git a/2024-10-31.md b/2024-10-31.md deleted file mode 100644 index 2b36d96..0000000 --- a/2024-10-31.md +++ /dev/null @@ -1 +0,0 @@ -# 2024-10-31 diff --git a/eslint.config.mjs b/eslint.config.mjs index e22c302..147bb2d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -22,6 +22,7 @@ export default antfu( rules: { 'eslint-comments/no-unlimited-disable': 'off', 'ts/no-require-imports': 'off', + 'eqeqeq': 'off', }, }, prettierConfig, diff --git a/project.private.config.json b/project.private.config.json index e5757c2..8e05015 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -9,6 +9,13 @@ "miniprogram": { "list": [ { + "name": "病历反馈", + "pathName": "module1/pages/casesFeedback/index", + "query": "id=317&rid=undefined", + "launchMode": "default", + "scene": null + }, + { "name": "帮助中心", "pathName": "module1/pages/help/index", "query": "", @@ -128,13 +135,6 @@ "scene": null }, { - "name": "病历反馈", - "pathName": "module1/pages/casesFeedback/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { "name": "录入病历结果", "pathName": "module1/pages/entryCasesResult/index", "query": "", @@ -256,5 +256,5 @@ ] } }, - "libVersion": "3.6.3" + "libVersion": "3.7.7" } \ No newline at end of file diff --git a/src/components/uploadFile/index.ts b/src/components/uploadFile/index.ts index b38e768..d6f6c9d 100644 --- a/src/components/uploadFile/index.ts +++ b/src/components/uploadFile/index.ts @@ -6,22 +6,26 @@ Component({ * 组件的属性列表 */ properties: { + // 是否获取用户头像 chooseAvatar: { type: Boolean, value: false, }, + // 从聊天记录选择问就爱你 chooseMessage: { type: Boolean, value: false, }, accept: { type: String, - value: "image", + value: 'image', }, + // 是否编辑图片,只对图片生效 obscure: { type: Boolean, value: false, }, + // 是否显示引导用户编辑图片引导 edit: { type: Boolean, value: false, @@ -34,9 +38,12 @@ Component({ data: { show1: false, fileTypeList: { + image: 1, + audio: 2, + video: 3, + pdf: 4, doc: 5, docx: 5, - pdf: 4, xls: 6, xlsx: 6, ppt: 7, @@ -48,15 +55,16 @@ Component({ * 组件的方法列表 */ methods: { - GetExtensionFileName(pathfilename) { + GetExtensionFileName(pathfilename: string) { const reg = /(\\+)/g; - const pString = pathfilename.replace(reg, "#"); //用正则表达式来将\或\\替换成# - const arr = pString.split("#"); // 以“#”为分隔符,将字符分解为数组 例如 D Program Files bg.png + const pString = pathfilename.replace(reg, '#'); //用正则表达式来将\或\\替换成# + const arr = pString.split('#'); // 以“#”为分隔符,将字符分解为数组 例如 D Program Files bg.png const lastString = arr[arr.length - 1]; //取最后一个字符 - const arr2 = lastString.split("."); // 再以"."作为分隔符 + const arr2 = lastString.split('.'); // 再以"."作为分隔符 return arr2[arr2.length - 1]; //将后缀名返回出来 }, - handleAfterRead(e, editEnd = false) { + handleAfterRead(e: any, editEnd = false) { + const file = { tempFilePath: e.detail.file.url, fileType: e.detail.file.type, ...e.detail.file }; if (this.data.edit && !editEnd) { this.setData({ show1: true, @@ -64,28 +72,28 @@ Component({ }); return; } - if (this.data.obscure) { + if (this.data.obscure && file.type === 'image') { wx.editImage({ - src: e.detail.file.url || e.detail.file.tempFilePath, + src: file.tempFilePath, success: (res: any) => { this.uploadFile({ - ...e.detail.file, + ...file, tempFilePath: res.tempFilePath, }).then((res) => { - this.triggerEvent("file", res as object); + this.triggerEvent('file', res as object); }); }, fail: (err) => { - if (err.errMsg.includes("开发者工具")) { - this.uploadFile(e.detail.file).then((res) => { - this.triggerEvent("file", res as object); + if (err.errMsg.includes('开发者工具')) { + this.uploadFile(file).then((res) => { + this.triggerEvent('file', res as object); }); } }, }); } else { - this.uploadFile(e.detail.file).then((res) => { - this.triggerEvent("file", res as object); + this.uploadFile(file).then((res) => { + this.triggerEvent('file', res as object); }); } }, @@ -95,18 +103,18 @@ Component({ }); this.handleAfterRead(this.data.cacheEditParams, true); }, - handleChooseAvatar(e) { + handleChooseAvatar(e: any) { this.uploadFile({ - fileType: "image", + fileType: 'image', tempFilePath: e.detail.avatarUrl, size: 0, }).then((res) => { - this.triggerEvent("file", res as object); + this.triggerEvent('file', res as object); }); }, handleChooseFile() { wx.chooseMessageFile({ - type: "file", + type: 'file', count: 1, success: (res) => { this.uploadFile({ @@ -114,66 +122,68 @@ Component({ fileType: res.tempFiles[0].type, tempFilePath: res.tempFiles[0].path, }).then((res) => { - this.triggerEvent("file", res as object); + this.triggerEvent('file', res as object); }); }, fail() { wx.showToast({ - icon: "none", - title: "取消选择", + icon: 'none', + title: '取消选择', }); }, }); }, - uploadFile(item) { + uploadFile(item: { tempFilePath: string; fileType: string; size: number; name?: string; duration?: number }) { + const { fileTypeList } = this.data; wx.showLoading({ - title: "正在上传", + title: '正在上传', }); return new Promise((resolve, reject) => { let url = `${app.globalData.upFileUrl}?r=file-service/upload-`; - if (item.fileType === "image") { - url += "img"; - } else if (item.fileType === "video" || item.type === "video") { - url += "video"; - item.tempFilePath = item.url; - } else if (item.fileType === "audio") { - url += "audio"; + if (item.fileType === 'image') { + url += 'img'; + } else if (item.fileType === 'video') { + url += 'video'; + } else if (item.fileType === 'audio') { + url += 'audio'; } else { - url += "doc"; + url += 'doc'; } wx.uploadFile({ filePath: item.tempFilePath, - name: "file", + name: 'file', url, success: (res) => { wx.hideLoading(); const data = JSON.parse(res.data); const suffix = this.GetExtensionFileName(data.data.Url); const expandJson = { - fileId: "", + fileId: '', name: item.name || `病历相关文件.${suffix}`, size: (item.size / 1024).toFixed(2), fileUrl: data.data.Url, + imgUrl: '', suffix, type: item.fileType, - imgUrl: "", duration: 0, - fileType: this.data.fileTypeList[suffix] || 99, - videoUrl: "", - hash: "", + hash: '', + fileType: fileTypeList[suffix] || 99, }; - if (item.fileType === "image") { + if (item.fileType === 'image') { + expandJson.fileType = fileTypeList.image; expandJson.imgUrl = data.data.Url; - } else if (item.fileType === "video" || item.type === "video") { + } else if (item.fileType === 'video') { + expandJson.fileType = fileTypeList.video; expandJson.imgUrl = data.data.SnapshotUrl; - } else if (item.fileType === "audio") { - expandJson.duration = Number.parseInt(String(item.duration / 1000)); + } else if (item.fileType === 'audio') { + expandJson.fileType = fileTypeList.audio; + expandJson.duration = item.duration ? Number.parseInt(String(item.duration / 1000)) : 0; } resolve(expandJson); }, fail() { wx.hideLoading(); - reject(new Error("上传失败")); + reject(new Error('上传失败')); }, }); }); diff --git a/src/images/video-sign.png b/src/images/video-sign.png new file mode 100644 index 0000000..c120823 Binary files /dev/null and b/src/images/video-sign.png differ diff --git a/src/module1/pages/casesDetail/index.scss b/src/module1/pages/casesDetail/index.scss index 8b274c1..cc856e6 100644 --- a/src/module1/pages/casesDetail/index.scss +++ b/src/module1/pages/casesDetail/index.scss @@ -28,7 +28,7 @@ page { justify-content: space-between; &::before { flex-shrink: 0; - content: ""; + content: ''; width: 10rpx; height: 40rpx; background: #00b4c5; @@ -230,10 +230,33 @@ page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12rpx; - .photo { + .photo-wrap { + position: relative; width: 100%; height: 128rpx; - border-radius: 8rpx; + .photo { + width: 100%; + height: 128rpx; + border-radius: 8rpx; + } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { @@ -381,7 +404,7 @@ page { position: absolute; bottom: -12rpx; left: 45%; - content: ""; + content: ''; width: 0; height: 0; border-style: solid; @@ -406,7 +429,7 @@ page { &::before { margin-right: 22rpx; flex-shrink: 0; - content: ""; + content: ''; width: 10rpx; height: 40rpx; background: #00b4c5; @@ -561,10 +584,33 @@ page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12rpx; - .photo { + .photo-wrap { + position: relative; width: 100%; height: 128rpx; - border-radius: 8rpx; + .photo { + width: 100%; + height: 128rpx; + border-radius: 8rpx; + } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { @@ -775,6 +821,7 @@ page { position: fixed; bottom: 0; left: 0; + z-index: 10; width: 100%; padding: 32rpx 32rpx calc(env(safe-area-inset-bottom) + 32rpx); box-sizing: border-box; @@ -880,7 +927,7 @@ page { position: absolute; bottom: -12rpx; left: 20rpx; - content: ""; + content: ''; width: 0; height: 0; border-style: solid; diff --git a/src/module1/pages/casesDetail/index.ts b/src/module1/pages/casesDetail/index.ts index ff35e93..9712289 100644 --- a/src/module1/pages/casesDetail/index.ts +++ b/src/module1/pages/casesDetail/index.ts @@ -193,11 +193,16 @@ Page({ }, handleImagePreview(e) { - const { url, parent } = e.currentTarget.dataset; - const urls = parent.map((item) => item.url); - wx.previewImage({ - urls, - current: url, + const { index, parent } = e.currentTarget.dataset; + const sources = parent.map((item) => { + return { + url: item.fileType == 3 ? item.videoUrl : item.url, + type: item.fileType == 3 ? 'video' : 'image', + }; + }); + wx.previewMedia({ + sources, + current: index, }); }, diff --git a/src/module1/pages/casesDetail/index.wxml b/src/module1/pages/casesDetail/index.wxml index ef86e95..540f4b0 100644 --- a/src/module1/pages/casesDetail/index.wxml +++ b/src/module1/pages/casesDetail/index.wxml @@ -56,16 +56,19 @@ - + bind:tap="handleImagePreview" + data-parent="{{detail.caseImages}}" + data-index="{{index}}" + > + + + + + 病历备注 @@ -75,9 +78,7 @@ - - 转文字 - + 转文字 @@ -171,24 +172,25 @@ - - 转文字 - + 转文字 - + bind:tap="handleImagePreview" + data-parent="{{item.feedbackImages}}" + data-index="{{index}}" + > + + + + + 补充文件 diff --git a/src/module1/pages/casesFeedback/index.scss b/src/module1/pages/casesFeedback/index.scss index 9bae9ec..08828a6 100644 --- a/src/module1/pages/casesFeedback/index.scss +++ b/src/module1/pages/casesFeedback/index.scss @@ -98,6 +98,24 @@ page { color: rgba(237, 79, 57, 1); } } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { @@ -291,6 +309,7 @@ page { position: fixed; bottom: 0; left: 0; + z-index: 10; padding: 32rpx 32rpx calc(env(safe-area-inset-bottom) + 32rpx); width: 100%; box-sizing: border-box; diff --git a/src/module1/pages/casesFeedback/index.ts b/src/module1/pages/casesFeedback/index.ts index 5e8f57b..922daa9 100644 --- a/src/module1/pages/casesFeedback/index.ts +++ b/src/module1/pages/casesFeedback/index.ts @@ -48,7 +48,7 @@ Page({ handleMapPhoto() { app.mpBehavior({ PageName: "BTN_FEEDBACKSELECTIMAGE" }); }, - handlePhoto(e) { + handleMedia(e) { const detail = e.detail; const images = this.data.images; this.setData({ @@ -56,13 +56,17 @@ Page({ ...images, { name: detail.name, - url: detail.fileUrl, + url: detail.fileType == 3 ? detail.imgUrl : detail.fileUrl, isRepeat: 2, - hash: "", + hash: '', + fileType: detail.fileType, + videoUrl: detail.fileType == 3 ? detail.fileUrl : '', }, ], }); - this.imageVerify(detail.fileUrl); + if (detail.fileType == 1) { + this.imageVerify(detail.fileUrl); + } this.handleCache(); }, handleDelPhoto(e) { @@ -345,12 +349,21 @@ Page({ showMsg: false, }); }, - handlePreviewImage(e) { - const { url } = e.currentTarget.dataset; + handlePreviewMedia(e) { + const { index } = e.currentTarget.dataset; const { images } = this.data; - wx.previewImage({ - urls: images.map((item) => item.url), - current: url, + const sources = images.reduce((pre, cur) => { + return [ + ...pre, + { + url: cur.fileType === 3 ? cur.videoUrl : cur.url, + type: cur.fileType === 3 ? 'video' : 'image', + }, + ]; + }, []); + wx.previewMedia({ + sources, + current: index, }); }, }); diff --git a/src/module1/pages/casesFeedback/index.wxml b/src/module1/pages/casesFeedback/index.wxml index c330209..9919b7a 100644 --- a/src/module1/pages/casesFeedback/index.wxml +++ b/src/module1/pages/casesFeedback/index.wxml @@ -23,12 +23,7 @@ data-index="{{index}}" > - + 转文字 @@ -41,11 +36,11 @@ - 上传图片建议 + 上传图片/视频建议 ({{images.length}}/9) - + @@ -54,8 +49,11 @@ 重复图片 + + + - + diff --git a/src/module1/pages/chatRoom/index.scss b/src/module1/pages/chatRoom/index.scss index 274fa56..6038923 100644 --- a/src/module1/pages/chatRoom/index.scss +++ b/src/module1/pages/chatRoom/index.scss @@ -936,10 +936,33 @@ page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12rpx; - .photo { + .photo-wrap { + position: relative; width: 100%; height: 128rpx; - border-radius: 8rpx; + .photo { + width: 100%; + height: 128rpx; + border-radius: 8rpx; + } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { @@ -1219,10 +1242,33 @@ page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12rpx; - .photo { + .photo-wrap { + position: relative; width: 100%; height: 128rpx; - border-radius: 8rpx; + .photo { + width: 100%; + height: 128rpx; + border-radius: 8rpx; + } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { diff --git a/src/module1/pages/chatRoom/index.ts b/src/module1/pages/chatRoom/index.ts index 7676790..b682330 100644 --- a/src/module1/pages/chatRoom/index.ts +++ b/src/module1/pages/chatRoom/index.ts @@ -774,11 +774,16 @@ Page({ }); }, handleImagePreview(e) { - const { url, parent } = e.currentTarget.dataset; - const urls = parent.map((item) => item.url); - wx.previewImage({ - urls, - current: url, + const { index, parent } = e.currentTarget.dataset; + const sources = parent.map((item) => { + return { + url: item.fileType == 3 ? item.videoUrl : item.url, + type: item.fileType == 3 ? 'video' : 'image', + }; + }); + wx.previewMedia({ + sources, + current: index, }); }, }); diff --git a/src/module1/pages/chatRoom/index.wxml b/src/module1/pages/chatRoom/index.wxml index 2e487e7..18f51ef 100644 --- a/src/module1/pages/chatRoom/index.wxml +++ b/src/module1/pages/chatRoom/index.wxml @@ -366,16 +366,19 @@ - + bind:tap="handleImagePreview" + data-index="{{index}}" + data-parent="{{detail.caseImages}}" + > + + + + + 病历备注 @@ -481,17 +484,20 @@ - + bind:tap="handleImagePreview" + data-index="{{index}}" + data-parent="{{item.feedbackImages}}" + > + + + + + 补充文件 diff --git a/src/module1/pages/entryCases/index.scss b/src/module1/pages/entryCases/index.scss index b39666b..184747e 100644 --- a/src/module1/pages/entryCases/index.scss +++ b/src/module1/pages/entryCases/index.scss @@ -29,7 +29,7 @@ page { &.required { &::before { display: inline; - content: "*"; + content: '*'; color: rgba(255, 87, 51, 1); } } @@ -66,7 +66,7 @@ page { position: absolute; top: 0; right: 0; - z-index: 1; + z-index: 3; color: #fff; width: 32rpx; height: 32rpx; @@ -98,6 +98,24 @@ page { color: rgba(237, 79, 57, 1); } } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } .remark { diff --git a/src/module1/pages/entryCases/index.ts b/src/module1/pages/entryCases/index.ts index f368b9f..f8bd392 100644 --- a/src/module1/pages/entryCases/index.ts +++ b/src/module1/pages/entryCases/index.ts @@ -1,4 +1,4 @@ -import Toast from "@vant/weapp/toast/toast"; +import Toast from '@vant/weapp/toast/toast'; const app = getApp(); Page({ @@ -12,15 +12,15 @@ Page({ labelList: [] as any, images: [] as any, - description: "", + description: '', audios: [] as any, files: [] as any, - deptId: "", + deptId: '', labelIds: [] as any, DoctorLevel: 1, - caseId: "", + caseId: '', edit: true, DeleteAttachmentIds: [] as any, @@ -47,8 +47,8 @@ Page({ }, getVisit() { wx.ajax({ - method: "GET", - url: "?r=takeda/case/is-visit", + method: 'GET', + url: '?r=takeda/case/is-visit', data: {}, }).then((res) => { this.setData({ @@ -58,15 +58,15 @@ Page({ }, postVisit() { wx.ajax({ - method: "POST", - url: "?r=takeda/case/visit", + method: 'POST', + url: '?r=takeda/case/visit', data: {}, }); }, getDetail() { wx.ajax({ - method: "GET", - url: "?r=takeda/case/get-case-detail", + method: 'GET', + url: '?r=takeda/case/get-case-detail', data: { caseId: this.data.caseId, }, @@ -76,7 +76,7 @@ Page({ description: res.description, audios: res.caseAudios, files: res.caseFiles, - deptId: res.caseDeptId[0] || "", + deptId: res.caseDeptId[0] || '', labelIds: res.caseLabels.map((item) => item.labelId), labelList: this.data.deptList.find((item) => item.value === res.caseDeptId[0])?.options || [], }); @@ -85,8 +85,8 @@ Page({ getDoctorDict() { return wx .ajax({ - method: "GET", - url: "?r=takeda/reg/doctor-dict", + method: 'GET', + url: '?r=takeda/reg/doctor-dict', data: {}, }) .then((res) => { @@ -97,8 +97,8 @@ Page({ }, getInviteDoctorList() { wx.ajax({ - method: "GET", - url: "?r=takeda/case/get-invite-doctor-list", + method: 'GET', + url: '?r=takeda/case/get-invite-doctor-list', data: {}, }).then((res) => { this.setData({ @@ -107,9 +107,9 @@ Page({ }); }, handleMapPhoto() { - app.mpBehavior({ PageName: "BTN_INPUTCASEUPLOADIMAGE" }); + app.mpBehavior({ PageName: 'BTN_INPUTCASEUPLOADIMAGE' }); }, - handlePhoto(e) { + handleMedia(e) { const detail = e.detail; const { images, edit } = this.data; if (edit) { @@ -123,13 +123,17 @@ Page({ ...images, { name: detail.name, - url: detail.fileUrl, + url: detail.fileType == 3 ? detail.imgUrl : detail.fileUrl, isRepeat: 2, - hash: "", + hash: '', + fileType: detail.fileType, + videoUrl: detail.fileType == 3 ? detail.fileUrl : '', }, ], }); - this.imageVerify(detail.fileUrl); + if (detail.fileType === 1) { + this.imageVerify(detail.fileUrl); + } }, handleDelPhoto(e: any) { const { index } = e.currentTarget.dataset; @@ -151,8 +155,8 @@ Page({ } }); wx.ajax({ - method: "POST", - url: "?r=takeda/common/image-verify", + method: 'POST', + url: '?r=takeda/common/image-verify', data: { ImageUrl: url, LastImagesHash, @@ -167,7 +171,7 @@ Page({ if (res.code === 1001) { wx.showToast({ title: res.msg, - icon: "none", + icon: 'none', }); imageItem.repeat = true; } @@ -177,7 +181,7 @@ Page({ }); }, handleMapAudio() { - app.mpBehavior({ PageName: "BTN_INPUTCASERECORDVOICE" }); + app.mpBehavior({ PageName: 'BTN_INPUTCASERECORDVOICE' }); }, handleAudio(e) { this.setData({ @@ -194,9 +198,9 @@ Page({ }, handleDelAudio(e) { wx.showModal({ - title: "确认删除?", - confirmColor: "#00B4C5", - cancelColor: "#141515", + title: '确认删除?', + confirmColor: '#00B4C5', + cancelColor: '#141515', success: (res) => { if (res.confirm) { const { index } = e.currentTarget.dataset; @@ -208,7 +212,7 @@ Page({ }); }, handleMapFile() { - app.mpBehavior({ PageName: "BTN_INPUTCASESELECTFILE" }); + app.mpBehavior({ PageName: 'BTN_INPUTCASESELECTFILE' }); }, handleFile(e) { this.setData({ @@ -228,9 +232,9 @@ Page({ }, handleDelFile(e) { wx.showModal({ - title: "确认删除?", - confirmColor: "#00B4C5", - cancelColor: "#141515", + title: '确认删除?', + confirmColor: '#00B4C5', + cancelColor: '#141515', success: (res) => { if (res.confirm) { const { index } = e.currentTarget.dataset; @@ -252,8 +256,8 @@ Page({ showMenu: true, fail() { wx.showToast({ - title: "该文件无法预览", - icon: "none", + title: '该文件无法预览', + icon: 'none', }); }, }); @@ -264,12 +268,12 @@ Page({ const { index } = e.currentTarget.dataset; const item = this.data.files[index]; wx.showModal({ - title: "文件名", + title: '文件名', content: item.name, - confirmColor: "#00B4C5", - cancelColor: "#141515", + confirmColor: '#00B4C5', + cancelColor: '#141515', showCancel: false, - confirmText: "关闭", + confirmText: '关闭', }); }, handleDownloadFile(e) { @@ -286,15 +290,15 @@ Page({ tempFilePath, success() { wx.showToast({ - title: "下载成功", - icon: "none", + title: '下载成功', + icon: 'none', mask: true, }); }, fail() { wx.showToast({ - title: "下载失败,请重新尝试", - icon: "none", + title: '下载失败,请重新尝试', + icon: 'none', mask: true, }); }, @@ -304,7 +308,7 @@ Page({ }); }, handleDept(e) { - app.mpBehavior({ PageName: "BTN_INPUTCASETAG" }); + app.mpBehavior({ PageName: 'BTN_INPUTCASETAG' }); const { params } = e.currentTarget.dataset; this.setData({ deptId: params.value, @@ -313,7 +317,7 @@ Page({ }); }, handleLabel(e) { - app.mpBehavior({ PageName: "BTN_INPUTCASETAG" }); + app.mpBehavior({ PageName: 'BTN_INPUTCASETAG' }); const { params } = e.currentTarget.dataset; const labelIds = this.data.labelIds; const newLabelId = labelIds.includes(params.value) @@ -344,15 +348,15 @@ Page({ const { caseId, images, description, audios, files, deptId, labelIds } = this.data; if (!images.length && !description && !audios.length && !files.length && !deptId && !labelIds.length) { wx.showToast({ - title: "请完善信息", - icon: "none", + title: '请完善信息', + icon: 'none', }); return; } const params = this.formatParams(); - const url = caseId ? "?r=takeda/case/save-case" : "?r=takeda/case/create-case"; + const url = caseId ? '?r=takeda/case/save-case' : '?r=takeda/case/create-case'; wx.ajax({ - method: "POST", + method: 'POST', url, data: { ...params, @@ -368,22 +372,22 @@ Page({ const { deptId, labelIds, images } = this.data; if (images.length === 0) { wx.showToast({ - title: "请上传病历图片", - icon: "none", + title: '请上传病历图片', + icon: 'none', }); return; } if (deptId && !labelIds.length) { wx.showToast({ - title: "请选择标签", - icon: "none", + title: '请选择标签', + icon: 'none', }); return; } wx.navigateTo({ url: `/module1/pages/setCaseDoctor/index`, success: (res) => { - res.eventChannel.emit("acceptDataFromOpenerPage", { + res.eventChannel.emit('acceptDataFromOpenerPage', { caseId: this.data.caseId, params, }); @@ -391,7 +395,7 @@ Page({ }); }, handleNoInvite() { - Toast("您还没有合作医生,无法邀请医生讨论病历,可暂时存为草稿"); + Toast('您还没有合作医生,无法邀请医生讨论病历,可暂时存为草稿'); }, handleSave() {}, handleSubmit() {}, @@ -406,11 +410,11 @@ Page({ return; } wx.showModal({ - confirmColor: "#00B4C5", - cancelColor: "#141515", - title: "您的病历还未保存,是否要存为草稿?", - confirmText: "存为草稿", - cancelText: "退出", + confirmColor: '#00B4C5', + cancelColor: '#141515', + title: '您的病历还未保存,是否要存为草稿?', + confirmText: '存为草稿', + cancelText: '退出', success: (res) => { if (res.confirm) { this.handleCache(); @@ -420,18 +424,27 @@ Page({ }, }); }, - handlePreviewImage(e) { - const { url } = e.currentTarget.dataset; + handlePreviewMedia(e) { + const { index } = e.currentTarget.dataset; const { images } = this.data; - wx.previewImage({ - urls: images.map((item) => item.url), - current: url, + const sources = images.reduce((pre, cur) => { + return [ + ...pre, + { + url: cur.fileType === 3 ? cur.videoUrl : cur.url, + type: cur.fileType === 3 ? 'video' : 'image', + }, + ]; + }, []); + wx.previewMedia({ + sources, + current: index, }); }, getAuth() { wx.ajax({ - method: "GET", - url: "?r=takeda/case/get-case-detail-op-auth", + method: 'GET', + url: '?r=takeda/case/get-case-detail-op-auth', data: { caseId: this.data.caseId, }, diff --git a/src/module1/pages/entryCases/index.wxml b/src/module1/pages/entryCases/index.wxml index 662c1e0..c54e34b 100644 --- a/src/module1/pages/entryCases/index.wxml +++ b/src/module1/pages/entryCases/index.wxml @@ -5,11 +5,11 @@ - 上传病历图片 + 上传病历图片/视频 ({{images.length}}/9) - + @@ -18,8 +18,18 @@ 重复图片 + + + - + diff --git a/src/pages/cases/index.scss b/src/pages/cases/index.scss index 013010f..2a425a9 100644 --- a/src/pages/cases/index.scss +++ b/src/pages/cases/index.scss @@ -29,7 +29,7 @@ page { width: 48rpx; height: 8rpx; border-radius: 8rpx 8rpx 0 0; - content: ""; + content: ''; background-color: rgba(0, 180, 197, 1); } } @@ -198,7 +198,7 @@ page { align-items: center; &::before { flex-shrink: 0; - content: ""; + content: ''; width: 10rpx; height: 40rpx; background: #00b4c5; @@ -264,7 +264,7 @@ page { position: absolute; bottom: -12rpx; left: 45%; - content: ""; + content: ''; width: 0; height: 0; border-style: solid; @@ -335,10 +335,33 @@ page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12rpx; - .photo { + .photo-wrap { + position: relative; width: 100%; height: 148rpx; - border-radius: 8rpx; + .photo { + width: 100%; + height: 100%; + border-radius: 8rpx; + } + .video-sign { + position: absolute; + top: 0; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + font-size: 20rpx; + border-radius: 8rpx; + background: rgba(9, 9, 9, 0.3); + display: flex; + align-items: center; + justify-content: center; + .icon { + width: 48rpx; + height: 48rpx; + } + } } } } diff --git a/src/pages/cases/index.ts b/src/pages/cases/index.ts index 91093ec..d49c719 100644 --- a/src/pages/cases/index.ts +++ b/src/pages/cases/index.ts @@ -8,9 +8,9 @@ Page({ show2: false, show3: false, showArea: false, - fieldNames: { text: "label", value: "value", children: "children" }, + fieldNames: { text: 'label', value: 'value', children: 'children' }, - nav: "0", + nav: '0', area: [], caseStatusList: {}, @@ -24,7 +24,7 @@ Page({ }, list: [], - hostilatSearch: "", + hostilatSearch: '', hostipalList: [], hospitalClassification: {}, hospitalLevel: {}, @@ -37,32 +37,32 @@ Page({ deptList: [] as any, labelList: [] as any, - caseStatusName: "全部", - hospitalName: "全部", - deptName: "全部", - labelName: "全部", - provinceName: "", - cityName: "", - countyName: "", + caseStatusName: '全部', + hospitalName: '全部', + deptName: '全部', + labelName: '全部', + provinceName: '', + cityName: '', + countyName: '', - search: "", + search: '', caseStatus: [] as any, hospitalId: [] as any, - submitTimeBegin: "", - submitTimeEnd: "", - feedbackTimeBegin: "", - feedbackTimeEnd: "", + submitTimeBegin: '', + submitTimeEnd: '', + feedbackTimeBegin: '', + feedbackTimeEnd: '', deptId: [] as any, labelId: [] as any, - provinceId: "", - cityId: "", - countyId: "", - isReject: "", - isHighQuality: "", - isOpen: "", - needDeal: "", - newFeedback: "", - orderType: "feedbackTime", + provinceId: '', + cityId: '', + countyId: '', + isReject: '', + isHighQuality: '', + isOpen: '', + needDeal: '', + newFeedback: '', + orderType: 'feedbackTime', myCaseCount: 0, @@ -92,20 +92,20 @@ Page({ }, }); this.setData({ - caseStatus: app.globalData.caseStatus ? app.globalData.caseStatus.split(",") : "", + caseStatus: app.globalData.caseStatus ? app.globalData.caseStatus.split(',') : '', caseStatusName: app.globalData.caseStatusName, newFeedback: app.globalData.newFeedback, }); - app.globalData.caseNav = "0"; - app.globalData.caseStatus = ""; - app.globalData.caseStatusName = "全部"; - app.globalData.newFeedback = ""; + app.globalData.caseNav = '0'; + app.globalData.caseStatus = ''; + app.globalData.caseStatusName = '全部'; + app.globalData.newFeedback = ''; this.setData({ needDeal: app.globalData.needDeal, }); - app.globalData.needDeal = ""; + app.globalData.needDeal = ''; app.waitLogin().then(() => { - app.mpBehavior({ PageName: "PG_CASELIST" }); + app.mpBehavior({ PageName: 'PG_CASELIST' }); this.getBaseInfo(); this.getList(); this.getHospitalsList(); @@ -122,8 +122,8 @@ Page({ }, getNotice() { wx.ajax({ - method: "GET", - url: "?r=takeda/doctor/todo", + method: 'GET', + url: '?r=takeda/doctor/todo', data: {}, }).then((res) => { this.getTabBar().setData({ @@ -133,8 +133,8 @@ Page({ }, getBaseInfo() { wx.ajax({ - method: "GET", - url: "?r=takeda/case/get-base-info", + method: 'GET', + url: '?r=takeda/case/get-base-info', data: {}, }).then((res) => { this.setData({ @@ -146,8 +146,8 @@ Page({ }, getArea() { wx.ajax({ - method: "GET", - url: "/js/area.json", + method: 'GET', + url: '/js/area.json', isJSON: true, }).then((res) => { this.setData({ @@ -159,16 +159,16 @@ Page({ const { nav, noSearch } = e.currentTarget.dataset; this.setData({ nav, - isOpen: nav === "1" ? "1" : "", - isHighQuality: nav === "2" ? "1" : "", - isReject: "", + isOpen: nav === '1' ? '1' : '', + isHighQuality: nav === '2' ? '1' : '', + isReject: '', }); if (noSearch) return; this.handleSearch(); }, getList(newPage = 1) { wx.ajax({ - method: "POST", + method: 'POST', url: `?r=takeda/case/get-list&type=${Number(this.data.nav) + 1}&page=${newPage}`, data: { search: this.data.search, @@ -210,7 +210,7 @@ Page({ } }, handleSearchFocus() { - app.mpBehavior({ PageName: "BTN_CASELISTSEARCH" }); + app.mpBehavior({ PageName: 'BTN_CASELISTSEARCH' }); }, handleSearch() { this.getList(); @@ -223,7 +223,7 @@ Page({ handleCancel(e) { const { key } = e.currentTarget.dataset; this.setData({ - [key]: "", + [key]: '', }); this.handleSearch(); }, @@ -233,7 +233,7 @@ Page({ if (!value) { this.setData({ caseStatus: [], - caseStatusName: "全部", + caseStatusName: '全部', }); return; } @@ -244,12 +244,12 @@ Page({ caseStatus .filter((item) => item !== value) .map((item) => caseStatusList[item]) - .join(",") || "全部", + .join(',') || '全部', }); } else { this.setData({ caseStatus: [...caseStatus, value], - caseStatusName: [...caseStatus, value].map((item) => caseStatusList[item]).join(",") || "全部", + caseStatusName: [...caseStatus, value].map((item) => caseStatusList[item]).join(',') || '全部', }); } }, @@ -269,19 +269,19 @@ Page({ }); if (show2) { this.setData({ - hospitalId: "", - hospitalName: "全部", + hospitalId: '', + hospitalName: '全部', }); this.handleSearch(); } if (showArea) { this.setData({ - provinceId: "", - cityId: "", - countyId: "", - provinceName: "", - cityName: "", - countyName: "", + provinceId: '', + cityId: '', + countyId: '', + provinceName: '', + cityName: '', + countyName: '', }); this.handleSearch(); } @@ -289,23 +289,28 @@ Page({ this.setData({ deptId: [], labelId: [], - deptName: "全部", - labelName: "全部", + deptName: '全部', + labelName: '全部', }); this.handleSearch(); } }, handleImagePreview(e) { - const { url, parent } = e.currentTarget.dataset; - const urls = parent.map((item) => item.url); - wx.previewImage({ - urls, - current: url, + const { index, parent } = e.currentTarget.dataset; + const sources = parent.map((item) => { + return { + url: item.fileType == 3 ? item.videoUrl : item.url, + type: item.fileType == 3 ? 'video' : 'image', + }; + }); + wx.previewMedia({ + sources, + current: index, }); }, handleDetail(e) { const { params } = e.currentTarget.dataset; - app.mpBehavior({ PageName: "BTN_CASECARD" }); + app.mpBehavior({ PageName: 'BTN_CASECARD' }); this.setData({ entryDetail: true, }); @@ -322,8 +327,8 @@ Page({ }, getHostipalDict() { wx.ajax({ - method: "GET", - url: "?r=takeda/reg/hospital-dict", + method: 'GET', + url: '?r=takeda/reg/hospital-dict', data: {}, }).then((res) => { this.setData({ @@ -337,8 +342,8 @@ Page({ }, getHospitalsList(newPage = 1) { wx.ajax({ - method: "GET", - url: "?r=takeda/reg/hospitals", + method: 'GET', + url: '?r=takeda/reg/hospitals', data: { page: newPage, Search: this.data.hostilatSearch, @@ -357,7 +362,7 @@ Page({ }, handleHostipalBottom(e) { const hostipalPagination = this.data.hostipalPagination; - if (e.detail.direction === "botttom" && hostipalPagination.page < hostipalPagination.pages) { + if (e.detail.direction === 'botttom' && hostipalPagination.page < hostipalPagination.pages) { this.getHospitalsList(Number(hostipalPagination.page) + 1); } }, @@ -366,15 +371,15 @@ Page({ this.setData({ show2: false, hospitalId: this.data.hospitalId.includes(params.HospitalId) ? [] : [params.HospitalId], - hospitalName: this.data.hospitalId.includes(params.HospitalId) ? "全部" : params.Name, + hospitalName: this.data.hospitalId.includes(params.HospitalId) ? '全部' : params.Name, }); this.handleSearch(); }, getDoctorDict() { wx.ajax({ - method: "GET", - url: "?r=takeda/reg/doctor-dict", + method: 'GET', + url: '?r=takeda/reg/doctor-dict', data: {}, }).then((res) => { this.setData({ @@ -396,7 +401,7 @@ Page({ const newDeptName = this.data.deptList .filter((item) => newDeptId.includes(item.value)) .map((item) => item.label) - .join(","); + .join(','); const labelList = this.data.deptList .filter((item) => newDeptId.includes(item.value)) .reduce((pre, cur) => { @@ -404,10 +409,10 @@ Page({ }, []); this.setData({ deptId: newDeptId, - deptName: newDeptName || "全部", + deptName: newDeptName || '全部', labelList, labelId: [], - labelName: "全部", + labelName: '全部', }); }, handleLabel(e) { @@ -416,24 +421,24 @@ Page({ const newLabelId = labelId.includes(params.value) ? labelId.filter((item) => item !== params.value) : [...labelId, params.value]; - let labelName = ""; + let labelName = ''; labelList.forEach((item) => { if (newLabelId.includes(item.value)) { - labelName = `${labelName}${labelName ? "," : ""}${item.label}`; + labelName = `${labelName}${labelName ? ',' : ''}${item.label}`; } }); this.setData({ labelId: newLabelId, - labelName: labelName || "全部", + labelName: labelName || '全部', }); }, handleTagSubmit() { const { deptId, labelId } = this.data; if (deptId.length && !labelId.length) { wx.showToast({ - title: "请选择标签", - icon: "none", + title: '请选择标签', + icon: 'none', }); return; } @@ -464,16 +469,16 @@ Page({ handleRadio(e) { const { key } = e.currentTarget.dataset; const PageName = { - isReject: "BTN_CASELISTREJECTFILTER", - isHighQuality: "BTN_CASELISTQUALITYFILTER", - isOpen: "BTN_CASELISTPUBLIC", - newFeedback: "BTN_CASELISTUPDATE", + isReject: 'BTN_CASELISTREJECTFILTER', + isHighQuality: 'BTN_CASELISTQUALITYFILTER', + isOpen: 'BTN_CASELISTPUBLIC', + newFeedback: 'BTN_CASELISTUPDATE', }[key]; if (PageName) { app.mpBehavior({ PageName }); } this.setData({ - [key]: this.data[key] === "1" ? "" : "1", + [key]: this.data[key] === '1' ? '' : '1', }); this.handleSearch(); }, @@ -485,7 +490,7 @@ Page({ this.handleSearch(); }, handleFold() { - app.mpBehavior({ PageName: "BTN_CASELISTFILTERTOGGLE" }); + app.mpBehavior({ PageName: 'BTN_CASELISTFILTERTOGGLE' }); this.setData({ fold: !this.data.fold, }); @@ -494,14 +499,14 @@ Page({ const { index } = e.currentTarget.dataset; const params: any = this.data.list[index]; wx.showModal({ - confirmColor: "#00B4C5", - cancelColor: "#141515", - title: "确认删除该病历?", + confirmColor: '#00B4C5', + cancelColor: '#141515', + title: '确认删除该病历?', success: (e) => { if (e.confirm) { wx.ajax({ - method: "POST", - url: "?r=takeda/case/delete-case", + method: 'POST', + url: '?r=takeda/case/delete-case', data: { caseId: params.caseId, }, @@ -518,14 +523,14 @@ Page({ handleQuestion(e) { const { index } = e.currentTarget.dataset; const message = { - 1: "设为公开的病历,公开病历平台所有医生均可访问", - 2: "标为优质的病历,病历所在科室医生均可访问", - 3: "属于您所在科室的所有病历", + 1: '设为公开的病历,公开病历平台所有医生均可访问', + 2: '标为优质的病历,病历所在科室医生均可访问', + 3: '属于您所在科室的所有病历', }[index]; wx.showModal({ - confirmColor: "#00B4C5", + confirmColor: '#00B4C5', showCancel: false, - confirmText: "知道了", + confirmText: '知道了', content: message, }); }, diff --git a/src/pages/cases/index.wxml b/src/pages/cases/index.wxml index 3b4f6c0..03ce78e 100644 --- a/src/pages/cases/index.wxml +++ b/src/pages/cases/index.wxml @@ -244,17 +244,20 @@ - + > + + + + +