From 78fb2f01b686d5ee4473335b9d7f2ba497e5b938 Mon Sep 17 00:00:00 2001 From: liqi Date: Thu, 13 Feb 2025 10:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=9C=8D=E5=8A=A1=E5=8C=85?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 5 + .idea/UniappTool.xml | 14 + .idea/inspectionProfiles/Project_Default.xml | 43 ++ .idea/jsLibraryMappings.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/xk-doctor-wx.iml | 12 + api/servicePackage.js | 50 ++ common/js/common.js | 2 +- common/js/index.js | 133 ++++- common/js/request.js | 2 +- components/d-upload/d-upload.vue | 2 +- package.json | 1 + pnpm-lock.yaml | 22 + subPackages/sub_my/my_setAct.vue | 6 +- .../sub_pharmacist/pharmacist_info.vue | 8 +- .../addProductServicePackage.vue | 476 ++++++++++++++++++ .../components/basic-information.vue | 4 +- yarn.lock | 13 + 19 files changed, 795 insertions(+), 18 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/UniappTool.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/xk-doctor-wx.iml create mode 100644 api/servicePackage.js create mode 100644 pnpm-lock.yaml create mode 100644 subPackages/sub_workbench/workbench_recipe/addProductServicePackage.vue create mode 100644 yarn.lock diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..10b731c --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ diff --git a/.idea/UniappTool.xml b/.idea/UniappTool.xml new file mode 100644 index 0000000..13fa6e3 --- /dev/null +++ b/.idea/UniappTool.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..bc0bb29 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,43 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..c27af06 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..833bda5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/xk-doctor-wx.iml b/.idea/xk-doctor-wx.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/xk-doctor-wx.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/api/servicePackage.js b/api/servicePackage.js new file mode 100644 index 0000000..f425985 --- /dev/null +++ b/api/servicePackage.js @@ -0,0 +1,50 @@ +import { + req +} from '@/common/js/index.js'; + + + +// 添加西药-全部西药列表 +/** + * @param {Object} data + * 参数名称 必须 参数类型 说明 + */ +export function servicePageList(data) { + return req.request({ + url: 'prescription/service-package-list', + method: 'post', + data + }) +} + + +// 添加西药-常用西药列表 +/** + * @param {Object} data + * 参数名称 必须 参数类型 说明 + */ +export function servicePageCommon(data) { + return req.request({ + url: 'prescription/service-package-common', + method: 'post', + data + }) +} + +// 添加颗粒药药方 +export function addServicePackageRecipe(data) { + return req.request({ + url: 'prescription/add-service-package-recipe', + method: 'POST', + data + }) +} + +// 开服务包处方 prescription/add-granular-prescription +export function addServicePackagePrescription(data) { + return req.request({ + url: 'prescription/add-prescription-service-package', + method: 'POST', + data + }) +} diff --git a/common/js/common.js b/common/js/common.js index 12851a0..d5f3ad8 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -50,4 +50,4 @@ function _isPromise(obj) { return obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function' - } \ No newline at end of file + } diff --git a/common/js/index.js b/common/js/index.js index fe99b4b..e9f0ddd 100644 --- a/common/js/index.js +++ b/common/js/index.js @@ -1,17 +1,39 @@ import Request from './request.js'; import errorCode from './errorCode.js'; -let protocol = 'https'; //协议 -let baseUrl = 'app.xiaokang88.com/service/v1/'; // 域名 -// let protocol = 'http'; //协议 -// let baseUrl = 'www.xk888.com/service/v1/'; // 域名 +import {Base64} from "js-base64"; +// let protocol = 'https'; //协议 +// let baseUrl = 'app.xiaokang88.com/service/v1/'; // 域名 +let protocol = 'http'; //协议 +let baseUrl = 'www.xk888.com/service/v1/'; // 域名 export const config = { baseUrl: `${protocol}://${baseUrl}` } + +const arr = [ + 'mobile', + 'express_mobile', + 'doctor', + 'accept_tel', + 'patient_mobile', + 'id_card', + 'idcard', + 'password' +] + +// 敏感数据 +const sensitiveData = [ + 'id_card', + 'idcard' +] /** * 请求拦截器 * @param {*} options */ const reqInterceptor = async (options) => { + // 加密 + if (options.data != null) { + options.data = getRes(options.data, false) + } options.header = { ...options.header } @@ -31,7 +53,12 @@ const resInterceptor = (response, conf = {}) => { // 响应拦截器 if (statusCode >= 200 && statusCode < 300) { _responseLog(response, conf, "response 200-299") - return response.data + // 解密 + let res = response.data + if (res.data != null) { + res.data = getRes(res.data) + } + return res } else if (statusCode === 500) { uni.showToast({ icon: 'error', @@ -69,7 +96,6 @@ const resInterceptor = (response, conf = {}) => { res: response } } else { - console.log uni.showToast({ icon: 'error', title: response['msg'] || errorCode[statusCode] @@ -106,6 +132,101 @@ function _responseLog(res, conf = {}, describe = null) { } } +function getRes(obj, isDecode = true) { + try { + for (const key in obj) { + if (Array.isArray(obj[key])) { + obj[key] = getRes(obj[key]) + } else if (typeof obj[key] === 'object') { + obj[key] = getRes(obj[key]) + } else { + // 判断obj[key]是否在arr中 + if (arr.indexOf(key) !== -1) { + let aseFile = '' + if (isDecode === true) { + aseFile = customBase64Decode(obj[key]) + } else { + aseFile = customBase64Encode(obj[key]) + } + const isGarbled = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]|[\u{E000}-\u{F8FF}]/u.test( + typeof aseFile === 'string' ? aseFile : '' + ) + if (isGarbled) { + aseFile = obj[key] + } + if (isDecode === true) { + if (sensitiveData.indexOf(key) !== -1) { + // 数据脱敏,自动匹配姓名、手机号、身份证 + switch (key) { + case 'express_name': + case 'express_region': + case 'accept_name': + case 'patient': + // 保留前两个字符,其余用星号代替 + aseFile = aseFile.slice(0, 1).padEnd(aseFile.length, '*'); + break; + case 'mobile': + case 'express_mobile': + // 保留前三位和后四位,中间用星号代替 + aseFile = aseFile.slice(0, 3).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4); + break; + case 'id_card': + case 'idcard': + // 保留前六位和后四位,中间用星号代替 + aseFile = aseFile.slice(0, 6).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4); + break; + default: + // 默认情况下,全部用星号代替 + break; + } + } + } + obj[key] = aseFile + } + } + } + return obj + } catch (error) { + console.error('错误', error) + return obj + } +} + +function customBase64Decode(data) { + // return data + try { + // 第一次Base64解码 + const decodedFirst = Base64.decode(data) + // 截取从第30个字符开始往后的内容 + const subStr = decodedFirst.slice(30) + // 第二次Base64解码 + return Base64.decode(subStr) != ''? Base64.decode(subStr): data + } catch (error) { + console.error(`解码Base64字符串【${data}】时发生错误`, error) + return data + } +} + +// 加密 +function customBase64Encode(data) { + if (data == null || data === '') return data + // return data + try { + // 和加密方法差不多但是是要生成30个随机字符 + let randomString = '' + for (let i = 0; i < 30; i++) { + const randomChar = String.fromCharCode(Math.floor(Math.random() * (126 - 32 + 1)) + 32) + randomString += randomChar + } + const encoded = Base64.encode(data) + return Base64.encode(randomString + encoded) + } catch (error) { + console.error(`加密字符串【${data}】时发生错误`, error) + return data + } +} + + /** * 请求方法封装 */ diff --git a/common/js/request.js b/common/js/request.js index 908aab3..325288e 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -94,4 +94,4 @@ } }) } - } \ No newline at end of file + } diff --git a/components/d-upload/d-upload.vue b/components/d-upload/d-upload.vue index 9d09c6e..a49269b 100644 --- a/components/d-upload/d-upload.vue +++ b/components/d-upload/d-upload.vue @@ -82,7 +82,7 @@ // 后端地址 action: { type: String, - default: 'https://app.xiaokang88.com/service/v1/attachment/upload' + default: 'https://api.xiaokang88.com/open-api/upload/old-admin-img' }, // 最大上传数量 maxCount: { diff --git a/package.json b/package.json index 688e13f..1772db4 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "editor" ], "dependencies": { + "js-base64": "^3.7.7", "uview-ui": "^1.8.8" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..7052cd7 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,22 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + uview-ui: + specifier: ^1.8.8 + version: 1.8.8 + +packages: + + uview-ui@1.8.8: + resolution: {integrity: sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg==, tarball: https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz} + +snapshots: + + uview-ui@1.8.8: {} diff --git a/subPackages/sub_my/my_setAct.vue b/subPackages/sub_my/my_setAct.vue index 13c9c96..da08191 100644 --- a/subPackages/sub_my/my_setAct.vue +++ b/subPackages/sub_my/my_setAct.vue @@ -35,7 +35,7 @@ --> - + 退出登录 @@ -105,7 +105,7 @@ return } uni.uploadFile({ - url: 'https://app.xiaokang88.com/service/v1/attachment/upload', + url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img', filePath: res.tempFiles[0]['path'], name: 'file', header: { @@ -172,4 +172,4 @@ } \ No newline at end of file + diff --git a/subPackages/sub_pharmacist/pharmacist_info.vue b/subPackages/sub_pharmacist/pharmacist_info.vue index d20125d..9b6bb75 100644 --- a/subPackages/sub_pharmacist/pharmacist_info.vue +++ b/subPackages/sub_pharmacist/pharmacist_info.vue @@ -375,7 +375,7 @@ this.loading = false; } }, - + selectActed(){ uni.chooseImage({ count: 1, //默认9 @@ -397,7 +397,7 @@ return } uni.uploadFile({ - url: 'https://app.xiaokang88.com/service/v1/attachment/upload', + url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img', filePath: res.tempFiles[0]['path'], name: 'file', header: { @@ -452,7 +452,7 @@ return } uni.uploadFile({ - url: 'https://app.xiaokang88.com/service/v1/attachment/upload', + url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img', filePath: res.tempFiles[0]['path'], name: 'file', header: { @@ -563,4 +563,4 @@ margin-left: 5%; bottom: env(safe-area-inset-bottom); } - \ No newline at end of file + diff --git a/subPackages/sub_workbench/workbench_recipe/addProductServicePackage.vue b/subPackages/sub_workbench/workbench_recipe/addProductServicePackage.vue new file mode 100644 index 0000000..2855f91 --- /dev/null +++ b/subPackages/sub_workbench/workbench_recipe/addProductServicePackage.vue @@ -0,0 +1,476 @@ + + + + + diff --git a/subPackages/sub_workbench/workbench_upInfo/components/basic-information.vue b/subPackages/sub_workbench/workbench_upInfo/components/basic-information.vue index 706d757..9aa16b2 100644 --- a/subPackages/sub_workbench/workbench_upInfo/components/basic-information.vue +++ b/subPackages/sub_workbench/workbench_upInfo/components/basic-information.vue @@ -360,7 +360,7 @@ } uni.uploadFile({ - url: 'https://app.xiaokang88.com/service/v1/attachment/upload', + url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img', filePath: res.tempFiles[0]['path'], name: 'file', header: { @@ -700,4 +700,4 @@ } } } - \ No newline at end of file + diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..327cd1e --- /dev/null +++ b/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +js-base64@^3.7.7: + version "3.7.7" + resolved "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== + +uview-ui@^1.8.8: + version "1.8.8" + resolved "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz" + integrity sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg==