From 0db2feb26721b79d1f67efc1ca38e8cdc8f01851 Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Thu, 1 Feb 2024 11:32:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 1 + src/app.tsx | 1 + src/pages/index/index.tsx | 7 +- src/pages/instrument/instrument.tsx | 78 ++-- .../instrument_clickin_upload/index.less | 397 ++++++++++++++++++ src/pages/instrument_clickin_upload/index.tsx | 333 +++++++++++++++ src/pages/instrument_detail/index.tsx | 29 +- src/pages/user/user.tsx | 8 +- src/pages/webViewPage/webViewPage.tsx | 1 + src/utils/Interface.js | 117 ++++-- src/utils/request.js | 9 +- 11 files changed, 900 insertions(+), 81 deletions(-) create mode 100644 src/pages/instrument_clickin_upload/index.less create mode 100644 src/pages/instrument_clickin_upload/index.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 459f8dc..f9bce9b 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -16,6 +16,7 @@ export default defineAppConfig({ "pages/instrument/intro", "pages/instrument_manage/index", "pages/instrument_detail/index", + "pages/instrument_clickin_upload/index", 'pages/privacyPolicy/privacyPolicy', 'pages/userPolicy/userPolicy', 'pages/about/about', diff --git a/src/app.tsx b/src/app.tsx index 6f44b5f..980a96e 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -24,6 +24,7 @@ class App extends Component { return; } + go("/pages/instrument_clickin_upload/index"); // go("/pages/instrument/intro"); // Taro.switchTab({ // url: "/pages/user/user", diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 9792d4b..ebc0e6b 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -536,6 +536,8 @@ class Index extends Component { }; // 仪器绑定失败弹窗 onBindErrorClose = () => { + Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码 + Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号 this.setState({ isBindingError: false }); }; onBindErrorConfirm = () => { @@ -543,6 +545,8 @@ class Index extends Component { go("/pages/consultant/consultant"); }; onBeforeBindClose = () => { + Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码 + Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号 this.setState({ isBeforeBinding: false }); }; onBeforeBindConfirm = () => { @@ -553,7 +557,8 @@ class Index extends Component { goNursing = (item) => { console.log("goNursing", item); setStorageSync("instrument_item", JSON.stringify(item)); - go("/pages/instrument/intro?id=" + item.id); + go("/pages/instrument_clickin_upload/index?id=" + item.id); + // go("/pages/instrument/intro?id=" + item.id); }; /* 扫码进入逻辑 */ diff --git a/src/pages/instrument/instrument.tsx b/src/pages/instrument/instrument.tsx index 9c63827..badb949 100644 --- a/src/pages/instrument/instrument.tsx +++ b/src/pages/instrument/instrument.tsx @@ -17,20 +17,14 @@ import { Canvas, } from "@tarojs/components"; -import { InstrumentInfo } from "../../utils/Interface"; -import { - go, - back, - msg, - setStorageSync, - getStorageSync, -} from "../../utils/traoAPI"; +import { InstrumentInfo } from "@/utils/Interface"; +import { go, back, msg, setStorageSync, getStorageSync } from "@/utils/traoAPI"; -import { getImgInfo, contraction } from "../../utils/compressImage"; +import { getImgInfo, contraction } from "@/utils/compressImage"; /* 自定义组件 */ -import Navbar from "../../components/navbar/navbar"; -import PopupAlert from "../../components/popup/popup-alert"; +import Navbar from "@/components/navbar/navbar"; +import PopupAlert from "@/components/popup/popup-alert"; /* 组件 */ import "./instrument.less"; @@ -50,7 +44,7 @@ export default class Instrument extends Component { channelInfo: { id: "", serialImage: "", - serial: "", + serialCode: "", }, equipmentList: [ { @@ -86,22 +80,22 @@ export default class Instrument extends Component { onSerial = (event) => { const { value } = event.detail; let { channelInfo } = this.state; - channelInfo.serial = value; + channelInfo.serialCode = value; this.setState({ channelInfo }); }; - onScanCode() { - Taro.scanCode({ - scanType: ["qrCode"], - success: (res) => { - let { channelInfo } = this.state; - channelInfo.serial = res.result; + // onScanCode() { + // Taro.scanCode({ + // scanType: ["qrCode"], + // success: (res) => { + // let { channelInfo } = this.state; + // channelInfo.serialCode = res.result; - this.setState({ channelInfo }); - }, - }); - } + // this.setState({ channelInfo }); + // }, + // }); + // } onTipShow = () => { this.setState({ tipShow: true }); @@ -131,7 +125,7 @@ export default class Instrument extends Component { const bindCode = result.split("?")[1]; console.log("bindCode", bindCode); const { channelInfo } = this.state; - channelInfo.serial = bindCode; + channelInfo.serialCode = bindCode; this.setState({ channelInfo, }); @@ -270,7 +264,7 @@ export default class Instrument extends Component { onSelectChange(item) { const { channelInfo } = this.state; if (channelInfo.id === item.id) return; - channelInfo.serial = ""; + channelInfo.serialCode = ""; this.setState({ channelInfo: item, isVideo: this.isVideo(item.banner), @@ -304,6 +298,7 @@ export default class Instrument extends Component { if (data.code === 200) { if (data.data.length) { let item = data.data[0]; + item.serialCode = ""; this.setState({ equipmentList: data.data, channelInfo: item, @@ -320,8 +315,9 @@ export default class Instrument extends Component { mask: true, }); let { channelInfo } = this.state; + let res = await InstrumentInfo.manualCodeBinding({ - serial: channelInfo.serial, + serial: channelInfo.serialCode, serialImage: channelInfo.serialImage, instrumentId: channelInfo.id, }); @@ -342,7 +338,7 @@ export default class Instrument extends Component { }); let { channelInfo } = this.state; let res = await InstrumentInfo.scanCodeBinding({ - serial: channelInfo.serial, + serial: channelInfo.serialCode, instrumentId: channelInfo.id, }); Taro.hideLoading(); @@ -364,7 +360,7 @@ export default class Instrument extends Component { let { channelInfo } = this.state; let res = await InstrumentInfo.binding({ - serial: channelInfo.serial, + serial: channelInfo.serialCode, }); Taro.hideLoading(); if (res.data.code === 200) { @@ -401,7 +397,7 @@ export default class Instrument extends Component { } = this.state; return ( - { textAlgin="center" close={this.closeDev} confirm={this.closeDev} - /> + /> */} { 手写输入绑定 - - 扫码绑定 - - + {channelInfo.isScanCode === 1 && ( + + 扫码绑定 + + + )} @@ -559,7 +557,7 @@ export default class Instrument extends Component { placeholder="例如:FR10*********1" placeholder-style={style} onInput={this.onSerial} - value={channelInfo.serial} + value={channelInfo.serialCode} > diff --git a/src/pages/instrument_clickin_upload/index.less b/src/pages/instrument_clickin_upload/index.less new file mode 100644 index 0000000..b6b709c --- /dev/null +++ b/src/pages/instrument_clickin_upload/index.less @@ -0,0 +1,397 @@ +page { + background: #f8f8f8; +} + +.titlemain { + position: fixed; + z-index: 99; + width: 100%; + top: 0; + /* box-shadow: 0px 1.5px 6px rgba(0, 0, 0, 0.16) */ +} + +.titlemain .logoicon { + width: 223rpx; +} + +.titlemain .title { + position: relative; + display: flex; + align-items: center; + justify-content: center; +} + +.infobox1 { + /* background: #fff; */ + margin: 20rpx 0rpx; + box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05); + #myVideo { + display: block; + margin: 0; + padding: 0; + } +} + +.infobox1 .img { + position: relative; + width: calc(345rpx * 2); + height: calc(345rpx * 2); + overflow: hidden; + border-radius: 30rpx; + /* padding: 10rpx; */ + /* box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.05); */ + margin: auto; +} + +.video-cover { + position: absolute; + top: 300rpx; + left: 0; + width: 100%; + height: 160rpx; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + border-radius: 30rpx; +} + +.video-cover-icon { + width: 90rpx; + height: 90rpx; +} + +.video-cover-time { + margin-top: 26rpx; + font-size: 28rpx; + color: #fff; + text-align: center; +} + +.infobox2 { + background: #fff; + overflow: hidden; + margin: 20rpx 0 0; + box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05); +} +.infobox2 .info4 { + /* margin: 0 30rpx; */ + padding: 41rpx 32rpx 0 32rpx; +} +.infobox2 .info4 .imgbox { + position: relative; +} +.infobox2 .info4 .upload_header .upload_title { + font-size: 36rpx; + font-weight: bold; + color: #030000; +} +.infobox2 .info4 .upload_header .icon { + width: 36rpx; + height: 36rpx; +} + +.infobox2 .info4 .imgbox .img { + width: 180rpx; + height: 180rpx; + /* background: #DCB585; */ + border-radius: 20rpx; + margin: 43rpx 32rpx 0 0; + position: relative; + overflow: hidden; +} + +.infobox2 .info4 .imgbox .img .close { + position: absolute; + background: rgba(27, 7, 7, 0.5); + width: 46rpx; + height: 42rpx; + border-radius: 0 20rpx 0 20rpx; + right: 0; + top: 0; +} + +.infobox2 .info4 .imgbox .img .close image { + width: 20rpx; +} + +.infobox2 .info4 .imgbox .img2 { + margin: 43rpx 32rpx 0 0; + width: 180rpx; + height: 180rpx; + background: #fff; + border-radius: 20rpx; + border: 2rpx solid #dddddd; +} + +.infobox2 .info4 .imgbox .img2 image { + width: 40rpx; + height: 40rpx; +} + +.infobox2 .info4 .content { + background: #fff; + border-radius: 3rpx; + padding: 28rpx; + width: calc(100% - 28rpx - 28rpx); + height: 186rpx; + margin: 37rpx 0 20rpx; + /*box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.1);*/ + border: 2rpx solid #dddddd; + position: relative; +} +.infobox2 .info4 .content .textarea { + width: 100%; + height: 100%; + color: #000; + font-size: 28rpx; +} +.infobox2 .info4 .content .contenttip { + color: #e1e1e1; + font-size: 20rpx; + position: absolute; + right: 24rpx; + bottom: 18rpx; +} + +.infobox2 .info4 .content textarea { + width: 100%; + height: 100%; + font-size: 28rpx; + color: #000; + border-radius: 3rpx; +} +.placeholder { + font-size: 28rpx; +} +.confirm_btn { + position: fixed; + z-index: 999; + bottom: 0; + left: 0; + width: 100%; + height: 153rpx; + background: #ffffff; + box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21); + padding: 0 30rpx 21rpx; + box-sizing: border-box; +} + +.confirm_btn .btn { + width: 100%; + height: 90rpx; + line-height: 90rpx; + text-align: center; + background: #000000; + border-radius: 45rpx; + font-size: 32rpx; + font-weight: bold; + color: #ffffff; +} + +.infobox3 { + display: block; + margin: 20rpx 31rpx; + height: 162rpx; + font-family: PingFang SC; + .info1 { + display: inline-block; + white-space: nowrap; + background: #fff; + flex-direction: column; + height: 100%; + border-radius: 20rpx; + overflow: hidden; + box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05); + margin-right: 23rpx; + } + .info2 { + width: calc(100% - 130rpx - 20rpx); + background: #fff; + height: 162rpx; + border-radius: 20rpx; + box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05); + } + + .info1, + .info2 { + .block1 { + // width: 300rpx; + // height: 160rpx; + flex-direction: column; + display: inline-block; + height: 100%; + text-align: center; + .block1_1 { + height: 100%; + padding: 0 20rpx; + flex-direction: column; + } + } + .info1_img { + width: 140rpx; + height: 140rpx; + margin-right: 10rpx; + border-radius: 20rpx; + overflow: hidden; + image { + width: 100%; + height: 100%; + } + } + .tip1 { + margin-top: 33rpx; + font-size: 26rpx; + font-weight: bold; + color: #000000; + } + .tip2 { + font-size: 24rpx; + font-weight: 400; + color: #666666; + margin-top: 15rpx; + } + .quan1 { + border-radius: 50%; + border: 3rpx solid #f1f1f1; + width: 30rpx; + height: 30rpx; + margin-top: 21rpx; + &.is-select { + display: flex; + background-color: #fff; + border-color: #fff; + align-items: center; + justify-content: center; + } + .quan2 { + border-radius: 50%; + background: #000000; + width: 14rpx; + height: 14rpx; + } + } + } + .info2 .block1 { + padding: 0 16rpx; + } +} + +.popbox { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + border-radius: 30rpx; + background: #fff; + position: relative; + padding-top: 52rpx; + padding-bottom: 40rpx; +} +.popbox > .closeicon1 { + position: absolute; + right: 20rpx; + top: 20rpx; + width: 24rpx; + height: 24rpx; +} +.popbox > .closeicon2 { + width: 130rpx; + margin: auto; +} +.popbox > .tip { + font-weight: bold; + font-size: 30rpx; + text-align: center; + margin-top: 27rpx; + color: #030000; +} +.popbox > .tip2 { + font-weight: bold; + font-size: 30rpx; + text-align: center; + margin-top: 20rpx; +} + +.popbox2 { +} +.popbox2 > .title { + text-align: center; + font-weight: bold; + font-size: 32rpx; + padding: 20rpx 0; + color: #212121; +} +.popbox2 > .tipimg { + margin: 20rpx 28rpx 0; +} +.popbox2 > .tipvideo { + margin: 20rpx 28rpx 0; + width: calc(100% - 28rpx - 28rpx); + height: 630rpx; +} +.popbox2 > .tiptext { + text-align: center; + color: #666666; + margin-top: 30rpx; + padding: 0 20rpx; + font-size: 28rpx; +} +.popbox2 > .popbox2btn > .nextbtn { + background: #000; + width: 270rpx; + height: 90rpx; + /*padding: 0 74rpx;*/ + text-align: center; + color: #fff; + font-size: 30rpx; + line-height: 90rpx; + /*margin: 50rpx auto 30rpx;*/ + border-radius: 45rpx; + box-sizing: border-box; +} +.popbox2 > .popbox2btn > .prebtn { + width: 270rpx; + height: 90rpx; + /*padding: 0 74rpx;*/ + text-align: center; + color: #000; + font-size: 30rpx; + line-height: 90rpx; + /*margin: 40rpx auto 30rpx;*/ + border-radius: 45rpx; + border: 1px solid #000; + margin-right: 20rpx; + box-sizing: border-box; +} +.popbox2btn { + display: flex; + align-items: center; + justify-content: center; + padding: 73rpx 54rpx 44rpx; +} + +.finish-tips { + margin-bottom: 80rpx; + font-size: 36rpx; + color: #030000; + text-align: center; + font-weight: bold; +} + +.finish-icon { + width: 120rpx; + height: 120rpx; +} + +.finish-btn { + background: #000; + width: 270rpx; + height: 90rpx; + text-align: center; + color: #fff; + font-size: 30rpx; + line-height: 90rpx; + margin: 40rpx auto 0; + border-radius: 45rpx; +} diff --git a/src/pages/instrument_clickin_upload/index.tsx b/src/pages/instrument_clickin_upload/index.tsx new file mode 100644 index 0000000..74d3ff4 --- /dev/null +++ b/src/pages/instrument_clickin_upload/index.tsx @@ -0,0 +1,333 @@ +import Taro from "@tarojs/taro"; +import classnames from "classnames"; + +import { Component, PropsWithChildren, useEffect, useState } from "react"; +import { + Block, + View, + Video, + Text, + Image, + Input, + Button, + ScrollView, + Textarea, + Canvas, +} from "@tarojs/components"; + +import Navbar from "@/components/navbar/navbar"; + +import { InstrumentInfo } from "@/utils/Interface"; + +import "./index.less"; +import { contraction, getImgInfo } from "@/utils/compressImage"; +import PopupAlert from "@/components/popup/popup-alert"; + +export default class InstrumentClickInUpload extends Component { + constructor(props) { + super(props); + this.state = { + name: "仪器打卡上传", + year: new Date().getFullYear(), + month: String(new Date().getMonth() + 1).padStart(2, "0"), + day: String(new Date().getDate()).padStart(2, "0"), + zkmoshiindex: 0, + moshiindex: null, + buzhouindex: null, + autoplay: false, + scrollleft: 0, + sysinfo: Taro.getSystemInfoSync(), + showVideoPlayBtn: true, + duration: 0, + + punchInInfo: { + imageList: [], + content: "", + instrumentId: "84", + }, + // 现在选中的数据 + currentInfo: { + modeVideo: "", + }, + modeInfo: [], + isModeLock: false, + }; + } + + async onLoad() { + this.initData(); + } + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() {} + + componentDidHide() {} + + async initData() { + this.firstNurseInfo(); + this.modeInfoList(); + } + + firstNurseInfo = async () => { + let res = await InstrumentInfo.firstNurseInfo({ + instrumentId: "84", + }); + console.log("firstNurseInfo", res); + }; + + modeInfoList = async () => { + let res = await InstrumentInfo.modeInfoList({ + instrumentId: "84", + }); + console.log("modeInfo", res); + if (res.data.code === 200) { + if (res.data.data.length) { + this.setState({ + currentInfo: res.data.data[0], + modeInfo: res.data.data, + }); + } + } + }; + + bindMoshi = async (index) => { + let { currentInfo, modeInfo, punchInInfo } = this.state; + currentInfo = modeInfo[index]; + this.setState({ zkmoshiindex: index, currentInfo }); + }; + + // 选择图片上传 + handleChooseImage = async () => { + let { punchInInfo } = this.state; + Taro.chooseMedia({ + count: 1, + mediaType: ["image"], + sourceType: ["album", "camera"], + sizeType: ["compressed"], + camera: "back", + success: async (res) => { + const tempFilePath = res.tempFiles[0].tempFilePath; + let img = await getImgInfo(tempFilePath); + let compressImage = await contraction(img, "compressImage"); + // 压缩后文件地址 + let compressTempFilePath = compressImage.tempFilePath; + punchInInfo.imageList.push(compressTempFilePath); + this.setState({ punchInInfo }); + }, + }); + }; + + handleDeleteImage = async (index) => { + let { punchInInfo } = this.state; + punchInInfo.imageList.splice(index, 1); + this.setState({ punchInInfo }); + }; + + onModeLockOpen = async () => { + this.setState({ isModeLock: true }); + }; + onModeLockClose = async () => { + this.setState({ isModeLock: false }); + }; + + onTipShow = async () => {}; + + handleSubmit = async () => {}; + + render() { + let { + name, + duration, + showVideoPlayBtn, + scrollleft, + zkmoshiindex, + punchInInfo, + tipshow, + currentInfo, + modeInfo, + isModeLock, + } = this.state; + return ( + + + + + + + + + + + + {modeInfo.map((item, index) => { + return ( + + + + + {item.modeName} + {item.modeDesc} + + {!item.lock && zkmoshiindex !== index && ( + + )} + {!item.lock && zkmoshiindex == index && ( + + + + )} + + {item.lock && ( + + + + )} + + + {item.modeBanner && ( + + + + )} + + + ); + })} + + + + + + + + 打卡上传 + + + + + + {punchInInfo.imageList.length > 0 && + punchInInfo.imageList.map((item, index) => { + return ( + + + + + + + ); + })} + + {punchInInfo.imageList.length < 3 && ( + + + + )} + + + {!tipshow && ( + + )} + + {tipshow && ( + + {punchInInfo.content + ? punchInInfo.content + : "请记录一下今天打卡的心得吧~"} + + )} + + + + + + + 提交打卡 + + + ); + } +} diff --git a/src/pages/instrument_detail/index.tsx b/src/pages/instrument_detail/index.tsx index 1e53cde..e3f63f6 100644 --- a/src/pages/instrument_detail/index.tsx +++ b/src/pages/instrument_detail/index.tsx @@ -8,6 +8,8 @@ import Navbar from "../../components/navbar/navbar"; import "./index.less"; import { getStorageSync } from "@/utils/traoAPI"; +import { InstrumentInfo } from "@/utils/Interface"; + export default class InstrumentDetail extends Component { constructor(props) { super(props); @@ -32,21 +34,30 @@ export default class InstrumentDetail extends Component { let objStr = getStorageSync("instrument_detail"); if (objStr) { let info = JSON.parse(objStr); - this.setState({ info: info }); + this.bindingInstrumentInfo(info.id); } } + bindingInstrumentInfo = async (id: string | number = "") => { + let res = await InstrumentInfo.bindingInstrumentInfo({ + instrumentId: id, + }); + if (res.data.code === 200) { + this.setState({ info: res.data.data }); + } + }; + render() { - let { name, info } = this.state; + let { info } = this.state; return ( - + 已绑定 - {info.name} + {info.instrumentName} {/* {info.iot == 2 && ( 当前软件版本号:{info.iot_versions} @@ -64,14 +75,18 @@ export default class InstrumentDetail extends Component { type="text" disabled={true} placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;" - placeholder={info.serial} + placeholder={info.bindingSerial} /> 序列号照片 - + @@ -93,7 +108,7 @@ export default class InstrumentDetail extends Component { type="text" disabled={true} placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;" - // placeholder={info.info.warranty_name} + placeholder={info.instrumentGuarantee + "年"} /> diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index a472557..e59dee7 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -197,7 +197,7 @@ class User extends Component { return ( - { textAlgin="center" close={this.closeDev} confirm={this.closeDev} - /> + /> */} { { if (!url?.includes("https://") && !url?.includes("http://")) { url = "https://" + url; } + console.log("url", url); this.setState({ url: url }); } diff --git a/src/utils/Interface.js b/src/utils/Interface.js index d480bd0..be6f954 100644 --- a/src/utils/Interface.js +++ b/src/utils/Interface.js @@ -231,9 +231,8 @@ export const GetSiteAddTag = (data) => { // 仪器管理 export const InstrumentInfo = { - // serial 序列号 + /**根据序列号获取仪器信息 serial 序列号*/ getInstrumentInfoBySerial: (data) => { - // 根据序列号获取仪器信息 return Ajax({ url: "/instrument/getInstrumentInfoBySerial" + paramsToUrlQueryString(data), @@ -241,8 +240,8 @@ export const InstrumentInfo = { method: "get", }); }, + /**根据序列号获取仪器信息*/ isBindingSerial: (data) => { - // 根据序列号获取仪器信息 return Ajax({ url: "/instrument/isBindingSerial" + paramsToUrlQueryString(data), data, @@ -250,55 +249,48 @@ export const InstrumentInfo = { }); }, + /**绑定仪器*/ binding: (data) => { - // 绑定仪器 return Ajax({ url: "/instrument/binding" + paramsToUrlQueryString(data), data, method: "get", }); }, + /**更换绑定仪器*/ exchangeBinding: (data) => { - // 更换绑定仪器 return Ajax({ url: "/instrument/exchangeBinding" + paramsToUrlQueryString(data), data, method: "get", }); }, + /**获取当前用户:已绑定仪器列表*/ bindingInstrumentList: () => { - // 获取当前用户:已绑定仪器列表 return Ajax({ url: "/instrument/bindingInstrumentList", method: "get", }); }, + + /**获取当前用户:未绑定仪器列表*/ unbindingInstrumentInfoList: () => { - // 获取当前用户:未绑定仪器列表 return Ajax({ url: "/instrument/unbindingInstrumentInfoList", method: "get", }); }, - bindingInstrumentInfo: () => { - // 获取当前用户:绑定记录 instrumentId + /**获取当前用户:绑定记录 instrumentId*/ + bindingInstrumentInfo: (data) => { return Ajax({ url: "/instrument/bindingInstrumentInfo" + paramsToUrlQueryString(data), method: "get", }); }, - // manualCodeBinding: (data) => { - // // 用户手动绑定仪器 - // return Ajax({ - // url: "/instrument/manualCodeBinding", - // data, - // method: "post", - // }); - // }, + /**用户手动绑定仪器 file 图片文件*/ manualCodeBinding: (formData) => { - // 用户手动绑定仪器 file 图片文件 return AjaxUploadFile( { url: "/instrument/manualCodeBinding", @@ -309,37 +301,108 @@ export const InstrumentInfo = { ); }, + /**用户扫码绑定仪器 serial instrumentId*/ scanCodeBinding: (data) => { - // 用户扫码绑定仪器 serial instrumentId return Ajax({ url: "/instrument/scanCodeBinding" + paramsToUrlQueryString(data), method: "get", }); }, + /**根据仪器ID:获取仪器介绍信息 instrumentId*/ instructionInfo: (data) => { - // 根据仪器ID:获取仪器介绍信息 instrumentId return Ajax({ url: "/instrument/instructionInfo" + paramsToUrlQueryString(data), - data, method: "get", }); }, + /**根据仪器ID:获取仪器的初次护理信息*/ firstNurseInfo: (data) => { - // 根据仪器ID:获取仪器的初次护理信息 return Ajax({ url: "/instrument/firstNurseInfo" + paramsToUrlQueryString(data), - data, method: "get", }); }, - modeInfo: (data) => { - // 根据仪器ID:获取仪器模式 + /**根据仪器ID:获取仪器模式列表*/ + modeInfoList: (data) => { return Ajax({ - url: "/instrument/modeInfo" + paramsToUrlQueryString(data), - data, + url: "/instrument/modeInfoList" + paramsToUrlQueryString(data), + method: "get", + }); + }, + /**获取设备升级数据 instrumentId*/ + getUpgrade: (data) => { + return Ajax({ + url: "/instrument/upgrade" + paramsToUrlQueryString(data), method: "get", }); }, + + /**打卡相关*/ + clock: { + /**添加用户使用仪器记录 instrumentId*/ + addClockInstrument: (data) => { + return Ajax({ + url: "/clock/addClockInstrument" + paramsToUrlQueryString(data), + data, + method: "get", + }); + }, + /**用户打卡*/ + postInsertClockLog: (data) => { + return Ajax({ + url: "/clock/insertClockLog", + data, + method: "post", + }); + }, + /**查询用户当天最新的一条打卡记录*/ + getLatestClockRecord: (data) => { + return Ajax({ + url: "/clock/latestClockRecord", + method: "get", + }); + }, + /**分页获取用户的打卡记录 page size*/ + getList: (data) => { + return Ajax({ + url: "/clock/list" + paramsToUrlQueryString(data), + data, + method: "get", + }); + }, + /**分页获取打卡统计*/ + getClockStatistics: (data) => { + return Ajax({ + url: "/clock/clockStatistics", + method: "get", + }); + }, + }, + /**护理相关*/ + nursingLog: { + /**新增用户护理日志*/ + addLog: (data) => { + return Ajax({ + url: "/nursingLog/add", + data, + method: "post", + }); + }, + /**查询用户护理记录*/ + getRecord: (data) => { + return Ajax({ + url: "/nursingLog/record" + paramsToUrlQueryString(data), + method: "get", + }); + }, + /**查询用户护理记录的当月统计信息*/ + getStatistics: (data) => { + return Ajax({ + url: "/nursingLog/statistics" + paramsToUrlQueryString(data), + method: "get", + }); + }, + }, }; //localhost:9204/instrument/getInstrumentInfoBySerial diff --git a/src/utils/request.js b/src/utils/request.js index e9bb9b5..559820f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -51,7 +51,7 @@ export const Ajax = (params) => { }, data: params.data, success(res) { - // console.log("res", res); + console.log("res", res); if (res.data.code == 401 || res.data.code == 403) { // 自动重新登录 Taro.removeStorageSync("token"); @@ -78,7 +78,12 @@ export const Ajax = (params) => { return false; } - reject(res); + Taro.showModal({ + title: "提示", + content: String(res.data.msg), + showCancel: false, + }); + // reject(res); return false; }