diff --git a/app.less b/app.less index 658b301..915fc66 100644 --- a/app.less +++ b/app.less @@ -28,6 +28,10 @@ page { button{ margin: 0; } + .t-image-viewer { + top: 0; + } + } .page { diff --git a/iconfont.less b/iconfont.less index 85b3a6c..81fd748 100644 --- a/iconfont.less +++ b/iconfont.less @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 4945922 */ - src: url('//at.alicdn.com/t/c/font_4945922_h7s60vu3p4o.woff2?t=1749983302860') format('woff2'), - url('//at.alicdn.com/t/c/font_4945922_h7s60vu3p4o.woff?t=1749983302860') format('woff'), - url('//at.alicdn.com/t/c/font_4945922_h7s60vu3p4o.ttf?t=1749983302860') format('truetype'); + src: url('//at.alicdn.com/t/c/font_4945922_6mzvl34xg5m.woff2?t=1750861347404') format('woff2'), + url('//at.alicdn.com/t/c/font_4945922_6mzvl34xg5m.woff?t=1750861347404') format('woff'), + url('//at.alicdn.com/t/c/font_4945922_6mzvl34xg5m.ttf?t=1750861347404') format('truetype'); } .iconfont { @@ -13,6 +13,54 @@ -moz-osx-font-smoothing: grayscale; } +.icon-x:before { + content: "\e602"; +} + +.icon-yanjing_yincang:before { + content: "\e6cc"; +} + +.icon-yanjing-xianshi:before { + content: "\e668"; +} + +.icon-gouxuan:before { + content: "\e608"; +} + +.icon-yisheng1:before { + content: "\e60d"; +} + +.icon-yisheng3:before { + content: "\e603"; +} + +.icon-mima:before { + content: "\e630"; +} + +.icon-mima1:before { + content: "\e7d1"; +} + +.icon-fanhui:before { + content: "\e601"; +} + +.icon-sousuo:before { + content: "\e733"; +} + +.icon-riqi:before { + content: "\e675"; +} + +.icon-nanbaobao:before { + content: "\e60a"; +} + .icon-jiahao2:before { content: "\e660"; } diff --git a/pages/followUp/index.js b/pages/followUp/index.js index f8676b8..78173d0 100644 --- a/pages/followUp/index.js +++ b/pages/followUp/index.js @@ -10,15 +10,15 @@ Page({ style: 'border: 2rpx solid #efefef;border-radius: 12rpx;', form: { - + liver_function_image:[], + b_mode_image: [], + blood_routine_image: [], + coagulation_function_image: [], + liver_function_image: [], + mdt_image: [], + nutritional_indicator_image: [] }, - key: 'filename.txt', //待上传的文件名称,您也可以指定其存储在某个目录下。例如,将filename.txt文件上传到youfolder文件夹下,此时需填写:/youfolder/filename.txt。 - policy: '', - xOssSecurityToken: '', - xOssSignatureVersion: '', - xOssCredential: '', - xOssDate: '', - xOssSignature: '', + @@ -113,7 +113,9 @@ Page({ config: { count: 1, }, - + imageVisible: false, + imageList: [], + imageIndex: 1, }, onInput(e) { @@ -157,9 +159,16 @@ Page({ console.log(e.detail.file); }, toQuestionnaire() { - request('patient/follow_questionnaire', 'post', { - - }) + const data = this.data.form + data.liver_function_image = data.liver_function_image.length > 0 ? data.liver_function_image.join(',') : '' + data.b_mode_image = data.b_mode_image.length > 0 ? data.b_mode_image.join(',') : '', + data.blood_routine_image = data.blood_routine_image.length > 0 ? data.blood_routine_image.join(',') : '', + data.coagulation_function_image = data.coagulation_function_image.length > 0 ? data.coagulation_function_image.join(',') : '', + data.liver_function_image = data.liver_function_image.length > 0 ? data.liver_function_image.join(',') : '', + data.mdt_image = data.mdt_image.length > 0 ? data.mdt_image.join(',') : '', + data.nutritional_indicator_image = data.nutritional_indicator_image.length > 0 ? data.nutritional_indicator_image.join(',') : '' + console.log(data) + request('patient/follow_questionnaire', 'post', data) }, handleChangeGroup(e) { console.log(e) @@ -169,24 +178,15 @@ Page({ }) }, //上传文件方法 - async uploadFileToOSS(filePath, callback) { - const { - key, - policy, - xOssSecurityToken, - xOssSignatureVersion, - xOssCredential, - xOssDate, - xOssSignature - } = this.data; + async uploadFileToOSS(file, callback) { + const policyData = await request('admin/policy_token', 'post') const res = JSON.parse(policyData.token) - console.log(res) const formData = { - key, //上传文件名称 + key: file.name, //上传文件名称 policy: res.policy, //表单域 'x-oss-signature-version': res.x_oss_signature_version, //指定签名的版本和算法 'x-oss-credential': res.x_oss_credential, //指明派生密钥的参数集 @@ -195,17 +195,19 @@ Page({ 'x-oss-security-token': res.security_token, //安全令牌 success_action_status: "200" //上传成功后响应状态码 }; - + // console.log(filePath) + // return // 发送请求上传文件 wx.uploadFile({ - url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', // 此域名仅作示例,实际Bucket域名,请替换为您的目标Bucket域名。 - filePath: filePath, + url: 'https://image-fudan.oss-cn-beijing.aliyuncs.com/', + method: 'put', + filePath: file.path, name: 'file', //固定值为file formData: formData, success(res) { console.log('上传响应:', res); if (res.statusCode === 200) { - callback(null, res.data); // 上传成功 + callback(null, 'https://image-fudan.oss-cn-beijing.aliyuncs.com/'+ file.name); // 上传成功 } else { console.error('上传失败,状态码:', res.statusCode); console.error('失败响应:', res); @@ -218,72 +220,17 @@ Page({ callback(err); // 调用回调处理错误 } }); - return - - const apiUrl = 'http://:/generate_signature' //请将IP地址和端口号替换为实际服务器公网IP地址及端口号 - // 发送请求获取签名信息 - wx.request({ - url: apiUrl, - success: (res) => { - - this.data.xOssSignatureVersion = res.x_oss_signature_version; - this.data.xOssCredential = res.x_oss_credential; - this.data.xOssDate = res.x_oss_date; - this.data.xOssSignature = res.signature; - this.data.xOssSecurityToken = res.security_token; - this.data.policy = res.policy; - - //此示例上传参数只列举必填字段,如有其他需求可参考: - //PostObject文档:https://help.aliyun.com/zh/oss/developer-reference/postobject - //签名版本4文档:https://help.aliyun.com/zh/oss/developer-reference/signature-version-4-recommend - const formData = { - key, //上传文件名称 - policy: this.data.policy, //表单域 - 'x-oss-signature-version': this.data.xOssSignatureVersion, //指定签名的版本和算法 - 'x-oss-credential': this.data.xOssCredential, //指明派生密钥的参数集 - 'x-oss-date': this.data.xOssDate, //请求的时间 - 'x-oss-signature': this.data.xOssSignature, //签名认证描述信息 - 'x-oss-security-token': this.data.xOssSecurityToken, //安全令牌 - success_action_status: "200" //上传成功后响应状态码 - }; - - // 发送请求上传文件 - wx.uploadFile({ - url: 'https://examplebucket.oss-cn-hangzhou.aliyuncs.com', // 此域名仅作示例,实际Bucket域名,请替换为您的目标Bucket域名。 - filePath: filePath, - name: 'file', //固定值为file - formData: formData, - success(res) { - console.log('上传响应:', res); - if (res.statusCode === 200) { - callback(null, res.data); // 上传成功 - } else { - console.error('上传失败,状态码:', res.statusCode); - console.error('失败响应:', res); - callback(res); // 上传失败,返回响应 - } - }, - fail(err) { - console.error('上传失败:', err); // 输出错误信息 - wx.showToast({ title: '上传失败,请重试!', icon: 'none' }); - callback(err); // 调用回调处理错误 - } - }); - }, - fail: (err) => { - console.error('请求接口失败:', err); - wx.showToast({ title: '获取上传参数失败,请重试!', icon: 'none' }); - } - }); + }, - handleUpload() { + handleUpload(e) { wx.chooseMessageFile({ count: 1, // 选择一个文件 type: 'all', // 支持所有类型的文件 success: (res) => { + wx.showToast({ title: '文件上传中,请稍等!', icon: 'none' }); console.log('选择的文件:', res.tempFiles); // 输出选择的文件信息 if (res.tempFiles.length > 0) { - const tempFilePath = res.tempFiles[0].path; // 获取选择的文件路径 + const tempFilePath = res.tempFiles[0]; console.log('选择的文件路径:', tempFilePath); // 输出文件路径 this.uploadFileToOSS(tempFilePath, (error, data) => { if (error) { @@ -291,6 +238,13 @@ Page({ console.error('上传失败:', error); // 输出具体的错误信息 } else { wx.showToast({ title: '上传成功!', icon: 'success' }); + const { mode } = e.currentTarget.dataset; + let arr = this.data.form[mode] + arr.unshift(data) + this.setData({ + [`form.${mode}`]: arr + }) + console.log('上传成功:', data); // 输出上传成功后的数据 } }); @@ -305,6 +259,45 @@ Page({ }); }, + imageKey:'', + handleImagePreview(e){ + const { mode, index } = e.currentTarget.dataset; + this.imageKey = mode + console.log(this.data.form[mode]) + this.setData({ + imageList: this.data.form[mode], + imageIndex: index, + imageVisible: true + }) + }, + onClose(){ + this.setData({ + imageVisible: false + }) + }, + handleDelete(){ + const { mode, index } = e.currentTarget.dataset; + let arr = this.data.form[mode] + arr.splice(index, 1) + this.setData({ + [`form.${mode}`]: arr + }) + }, + + onDelete(e){ + console.log(e) + let arr = this.data.form[this.imageKey] + arr.splice(e.detail.index, 1) + // let imageList = this.data.imageList + // imageList.splice(this.data.imageIndex, 1) + let imageIndex = e.detail.index + this.setData({ + // imageIndex: imageIndex - 1, + [`form.${this.imageKey}`]: arr, + imageList: arr, + imageVisible: arr.length != 0 + }) + }, /** * 生命周期函数--监听页面加载 */ diff --git a/pages/followUp/index.json b/pages/followUp/index.json index bfc2491..757974a 100644 --- a/pages/followUp/index.json +++ b/pages/followUp/index.json @@ -8,7 +8,8 @@ "t-button": "tdesign-miniprogram/button/button", "t-upload": "tdesign-miniprogram/upload/upload", "t-radio": "tdesign-miniprogram/radio/radio", - "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer" }, "navigationStyle": "default", "navigationBarTitleText": "填写随访问卷" diff --git a/pages/followUp/index.less b/pages/followUp/index.less index 05d0c52..59640e1 100644 --- a/pages/followUp/index.less +++ b/pages/followUp/index.less @@ -40,8 +40,8 @@ padding-right: 60rpx; } .improt-file{ - width: 140rpx; - height: 140rpx; + width: 196rpx; + height: 196rpx; background: rgba(0,91,162,0.05); border-radius: 16rpx; border: 2rpx dotted rgba(0,91,162,0.2); @@ -58,4 +58,48 @@ } } } + .report-image{ + width: 196rpx; + height: 196rpx; + background: #F8F8F8; + border-radius: 16rpx; + border: 1rpx solid #EEEEEE; + position: relative; + overflow: hidden; + image{ + width: 100%; + height: 100%; + } + .more{ + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border-radius: 16rpx; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + color: #fff; + font-size: 48rpx; + } + .delete-btn{ + position: absolute; + right: 0; + top: 0; + width: 40rpx; + height: 40rpx; + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0 16rpx 0 16rpx; + z-index: 2; + text{ + font-size: 24rpx; + } + } +} } \ No newline at end of file diff --git a/pages/followUp/index.wxml b/pages/followUp/index.wxml index 57ace3f..3a5cf1a 100644 --- a/pages/followUp/index.wxml +++ b/pages/followUp/index.wxml @@ -1,39 +1,35 @@ - + \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index aefe352..1c70d98 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,6 +2,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "添加随访", + "pathName": "pages/followUp/index", + "query": "", + "scene": null, + "launchMode": "default" + }, { "name": "pages/home/index", "pathName": "pages/home/index",