fix:bug修复

master
blak-kong 2 years ago
parent 64302d397e
commit 75413856f7

@ -0,0 +1,19 @@
.nodata {
width: 200rpx;
height: 300rpx;
margin: 0 auto;
// margin-top: 310rpx;
text-align: center;
.nodata_img {
display: inline-block;
width: 160rpx;
height: 160rpx;
margin-bottom: 34rpx;
}
.nodata_text {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: #666666;
}
}

@ -0,0 +1,45 @@
import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Component } from "react";
import { Block, View, Image } from "@tarojs/components";
import "./nodata.less";
export default class NoDataComponent extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "无数据组件",
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
showInit() {}
render() {
return (
<Block>
<View>
<View className="nodata">
<Image
className="nodata_img"
src={require("../../img/nodata.png")}
></Image>
<View className="nodata_text"></View>
</View>
</View>
</Block>
);
}
}

@ -104,10 +104,8 @@ class UpdateIotWL200 extends Component<any, any> {
let objStr = getStorageSync("instrument_detail"); let objStr = getStorageSync("instrument_detail");
if (objStr) { if (objStr) {
let info = JSON.parse(objStr);
this.setState({ this.setState({
currentDevice: info, currentDevice: objStr,
}); });
} }
setTimeout(() => { setTimeout(() => {

@ -64,6 +64,9 @@ class Index extends Component<any, any> {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
isCommonError: false, // 是否显示通用错误提示
commonErrorText: [], // 通用错误提示
showEquipment: false, // 扫码绑定设备弹窗 showEquipment: false, // 扫码绑定设备弹窗
isRegisterBoolean: false, // 是否已登录 isRegisterBoolean: false, // 是否已登录
isShowPrivacyPopup: false, isShowPrivacyPopup: false,
@ -172,7 +175,7 @@ class Index extends Component<any, any> {
componentDidHide() {} componentDidHide() {}
showInit() { showInit = async () => {
// 判断是否登录 // 判断是否登录
let mobile = Taro.getStorageSync("mobile"); let mobile = Taro.getStorageSync("mobile");
if (mobile) { if (mobile) {
@ -198,6 +201,7 @@ class Index extends Component<any, any> {
let serial = ids[1]; let serial = ids[1];
Taro.setStorageSync("serial", serial); Taro.setStorageSync("serial", serial);
if (!Taro.getStorageSync("mobile")) { if (!Taro.getStorageSync("mobile")) {
await this.onlyLogin();
go("/pages/register/register"); go("/pages/register/register");
} }
} }
@ -205,7 +209,7 @@ class Index extends Component<any, any> {
} }
this.checkShowPrivacyPopup(); this.checkShowPrivacyPopup();
} }
} };
// 检测是否弹出隐私协议 // 检测是否弹出隐私协议
checkShowPrivacyPopup() { checkShowPrivacyPopup() {
@ -446,6 +450,26 @@ class Index extends Component<any, any> {
}, 2000); }, 2000);
} }
} }
// 只登陆,不做其他操作
async onlyLogin() {
Taro.showLoading({
title: "请求中...",
mask: true,
});
const { code } = await Taro.login();
const { data } = await WCUserLogin({ code });
Taro.hideLoading();
if (data.code === 200) {
Taro.setStorageSync("isWelcome", true);
Taro.setStorageSync("mobile", data.data.mobile);
this.props.tokenRefresh(data.data);
} else {
msg("请求失败,尝试重新请求");
}
}
closeBinding = () => { closeBinding = () => {
this.setState({ isVisibleBinding: false }); this.setState({ isVisibleBinding: false });
}; };
@ -503,8 +527,7 @@ class Index extends Component<any, any> {
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码 this.removeScanFun();
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
} }
}; };
@ -540,6 +563,7 @@ class Index extends Component<any, any> {
}); });
Taro.hideLoading(); Taro.hideLoading();
this.closeBinding(); this.closeBinding();
this.removeScanFun();
if (data.code === 200) { if (data.code === 200) {
msg("绑定成功"); msg("绑定成功");
setTimeout(() => { setTimeout(() => {
@ -577,6 +601,7 @@ class Index extends Component<any, any> {
// 仪器绑定失败弹窗 // 仪器绑定失败弹窗
onBindErrorClose = () => { onBindErrorClose = () => {
this.setState({ isBindingError: false }); this.setState({ isBindingError: false });
this.removeScanFun();
}; };
onBindErrorConfirm = () => { onBindErrorConfirm = () => {
this.onBindErrorClose(); this.onBindErrorClose();
@ -584,16 +609,31 @@ class Index extends Component<any, any> {
}; };
onBeforeBindClose = () => { onBeforeBindClose = () => {
this.setState({ isBeforeBinding: false }); this.setState({ isBeforeBinding: false });
this.removeScanFun();
}; };
onBeforeBindConfirm = () => { onBeforeBindConfirm = () => {
this.setState({ isBeforeBinding: false }); this.setState({ isBeforeBinding: false });
this.removeScanFun();
};
/**删除扫码缓存*/
removeScanFun = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
}; };
// 跳转仪器介绍页 // 跳转仪器介绍页
goNursing = (item) => { goNursing = (item) => {
setStorageSync("instrument_detail", JSON.stringify(item)); if (item.status === 0) {
this.setState({ connectInstrument: item }); setStorageSync("instrument_detail", item);
setTimeout(() => this.bindBlockLeft()); this.setState({ connectInstrument: item });
setTimeout(() => this.bindBlockLeft());
} else {
// todo
this.openCommonError([
"该仪器暂时无法进行在线护理,",
"请联系微信小助理",
]);
}
}; };
/* 扫码进入逻辑 */ /* 扫码进入逻辑 */
@ -760,8 +800,26 @@ class Index extends Component<any, any> {
// this.goNursing() // this.goNursing()
}; };
/**
* @name
* @description
* @params
*/
openCommonError = (text) => {
this.setState({
commonErrorText: text,
isCommonError: true,
});
};
onCommonErrorFun = () => {
this.setState({
isCommonError: false,
});
};
render() { render() {
let { let {
isCommonError,
commonErrorText,
calendarComplete, calendarComplete,
calendarInComplete, calendarInComplete,
currentDate, currentDate,
@ -800,6 +858,21 @@ class Index extends Component<any, any> {
return ( return (
<Block> <Block>
<View catchMove> <View catchMove>
<PopupAlert
isShow={isCommonError}
title="提示"
content={
<Block>
{commonErrorText.map((item) => {
return <View>{item}</View>;
})}
</Block>
}
confirmButtonText="知道了"
textAlgin="center"
close={this.onCommonErrorFun}
confirm={this.onCommonErrorFun}
/>
<PopupConfirm <PopupConfirm
isShow={isShowReConnectDeviceRecordWL200} isShow={isShowReConnectDeviceRecordWL200}
isClose isClose
@ -829,7 +902,6 @@ class Index extends Component<any, any> {
} }
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
/> />
@ -878,7 +950,6 @@ class Index extends Component<any, any> {
} }
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
/> />
@ -888,7 +959,6 @@ class Index extends Component<any, any> {
content="您选择的仪器有误,请重新确认选择" content="您选择的仪器有误,请重新确认选择"
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onBeforeBindClose} close={this.onBeforeBindClose}
confirm={this.onBeforeBindConfirm} confirm={this.onBeforeBindConfirm}
/> />
@ -907,7 +977,6 @@ class Index extends Component<any, any> {
} }
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onUnloginClose.bind(this)} close={this.onUnloginClose.bind(this)}
confirm={this.onUnloginConfirm.bind(this)} confirm={this.onUnloginConfirm.bind(this)}
></PopupAlert> ></PopupAlert>
@ -1040,24 +1109,22 @@ class Index extends Component<any, any> {
<View style="overflow-x: auto;"> <View style="overflow-x: auto;">
<View className="device_list flex"> <View className="device_list flex">
{instrumentList.map((item, index) => { {instrumentList.map((item, index) => {
if (item.status === 0) { return (
return ( <View
<View key={"instrumentList" + index}
key={"instrumentList" + index} className="device_item"
className="device_item" onClick={this.goNursing.bind(this, item)}
onClick={this.goNursing.bind(this, item)} >
> <Image
<Image className="banner_img"
className="banner_img" src={item.banner}
src={item.banner} mode="aspectFill"
mode="aspectFill" />
/> <View className="device_name ellipsis1">
<View className="device_name ellipsis1"> {item.name}
{item.name}
</View>
</View> </View>
); </View>
} );
})} })}
</View> </View>
</View> </View>

@ -18,7 +18,7 @@ import {
} from "@tarojs/components"; } from "@tarojs/components";
import { InstrumentInfo } from "@/utils/Interface"; import { InstrumentInfo } from "@/utils/Interface";
import { go, msg, setStorageSync, getStorageSync } from "@/utils/traoAPI"; import { go, msg, setStorageSync } from "@/utils/traoAPI";
import { getImgInfo, contraction } from "@/utils/compressImage"; import { getImgInfo, contraction } from "@/utils/compressImage";
@ -26,6 +26,7 @@ import { getImgInfo, contraction } from "@/utils/compressImage";
import Navbar from "@/components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
import PopupAlert from "@/components/popup/popup-alert"; import PopupAlert from "@/components/popup/popup-alert";
import PopupBinding from "@/components/popup/popup-binding"; import PopupBinding from "@/components/popup/popup-binding";
import NoDataComponent from "@/components/base/nodata";
/* 组件 */ /* 组件 */
import "./instrument.less"; import "./instrument.less";
@ -66,6 +67,9 @@ export default class Instrument extends Component<any, any> {
isVisibleBinding: false, isVisibleBinding: false,
isRegisterBoolean: false, isRegisterBoolean: false,
isExchangeBinding: false, isExchangeBinding: false,
/** INPUT序列号拎出来防止上传图片被清空bug */
serialCodeValue: "",
}; };
} }
$instance = Taro.getCurrentInstance(); $instance = Taro.getCurrentInstance();
@ -79,6 +83,13 @@ export default class Instrument extends Component<any, any> {
componentWillUnmount() {} componentWillUnmount() {}
componentDidShow() { componentDidShow() {
// 进入页面判断是否注册,用于扫码登录
let mobile = Taro.getStorageSync("mobile");
if (mobile) {
this.setState({ isRegisterBoolean: true });
}
// 用于判断是否只显示一个设备
let params: any = this.$instance.router?.params; let params: any = this.$instance.router?.params;
if (params?.isOnly && params?.id) { if (params?.isOnly && params?.id) {
if (params?.isOnly === "true") { if (params?.isOnly === "true") {
@ -96,10 +107,7 @@ export default class Instrument extends Component<any, any> {
onSerial = (event) => { onSerial = (event) => {
const { value } = event.detail; const { value } = event.detail;
let { channelInfo } = this.state; this.setState({ serialCodeValue: value });
channelInfo.serialCode = value;
this.setState({ channelInfo });
}; };
onTipShow = () => { onTipShow = () => {
@ -170,16 +178,20 @@ export default class Instrument extends Component<any, any> {
let compressImage = await contraction(img, "compressImage"); let compressImage = await contraction(img, "compressImage");
// 压缩后文件地址 // 压缩后文件地址
let compressTempFilePath = compressImage.tempFilePath; let compressTempFilePath = compressImage.tempFilePath;
let { channelInfo } = this.state;
channelInfo.serialImage = compressTempFilePath; setTimeout(() => {
this.setState({ channelInfo }); let { channelInfo } = this.state;
channelInfo.serialImage = compressTempFilePath;
this.setState({ channelInfo });
});
}, },
}); });
}; };
onSubmit = () => { onSubmit = () => {
const { serialCode, serialImage, id } = this.state.channelInfo; const { serialImage } = this.state.channelInfo;
if (!serialCode?.trim()) return msg("请填写序列号");
if (!this.state.serialCodeValue?.trim()) return msg("请填写序列号");
if (!serialImage) return msg("请上传序列号照片"); if (!serialImage) return msg("请上传序列号照片");
this.manualCodeBinding(); this.manualCodeBinding();
}; };
@ -194,6 +206,7 @@ export default class Instrument extends Component<any, any> {
this.setState({ this.setState({
channelInfo: channelInfo, channelInfo: channelInfo,
isVideo: this.isVideo(item.banner), isVideo: this.isVideo(item.banner),
serialCodeValue: "",
}); });
setTimeout(() => { setTimeout(() => {
@ -226,27 +239,34 @@ export default class Instrument extends Component<any, any> {
if (data.code === 200) { if (data.code === 200) {
if (data.data.length) { if (data.data.length) {
if (!this.isOnly) { if (!this.isOnly) {
let item = data.data[0]; let equipmentList = data.data.filter((item) => item.status === 0);
if (equipmentList.length === 0) {
return;
}
let item = equipmentList[0];
item.serialCode = ""; item.serialCode = "";
this.setState({ this.setState({
equipmentList: data.data, equipmentList: equipmentList,
channelInfo: item, channelInfo: item,
isVideo: this.isVideo(item.banner), isVideo: this.isVideo(item.banner),
}); });
} else { } else {
let item = data.data.find((item) => String(item.id) === this.id); let item = data.data.find((item) => String(item.id) === this.id);
item.serialCode = ""; if (item) {
this.setState({ item.serialCode = "";
equipmentList: [item], this.setState({
channelInfo: item, equipmentList: [item],
isVideo: this.isVideo(item.banner), channelInfo: item,
}); isVideo: this.isVideo(item.banner),
});
}
} }
} }
} }
}; };
// 绑定仪器 // 手写绑定仪器
manualCodeBinding = async () => { manualCodeBinding = async () => {
Taro.showLoading({ Taro.showLoading({
title: "请求中...", title: "请求中...",
@ -255,12 +275,12 @@ export default class Instrument extends Component<any, any> {
let { channelInfo } = this.state; let { channelInfo } = this.state;
let res = await InstrumentInfo.manualCodeBinding({ let res = await InstrumentInfo.manualCodeBinding({
serial: channelInfo.serialCode, serial: this.state.serialCodeValue,
serialImage: channelInfo.serialImage, serialImage: channelInfo.serialImage,
instrumentId: channelInfo.id, instrumentId: channelInfo.id,
}); });
console.log("bindingInstrument", res);
Taro.hideLoading(); Taro.hideLoading();
// 文件上传接口返回格式不需要加data
if (res.code === 200) { if (res.code === 200) {
this.openBindingVisible(); this.openBindingVisible();
} else if (res.code === 204) { } else if (res.code === 204) {
@ -326,8 +346,8 @@ export default class Instrument extends Component<any, any> {
console.log("exchangeBinding", data); console.log("exchangeBinding", data);
Taro.hideLoading(); Taro.hideLoading();
this.closeBinding(); this.closeBinding();
if (data.code !== 200) { if (data.code === 200) {
//todo msg("换绑成功");
} }
}; };
@ -377,6 +397,7 @@ export default class Instrument extends Component<any, any> {
isVisibleBinding, isVisibleBinding,
isRegisterBoolean, isRegisterBoolean,
isExchangeBinding, isExchangeBinding,
serialCodeValue,
} = this.state; } = this.state;
return ( return (
<Block> <Block>
@ -412,9 +433,8 @@ export default class Instrument extends Component<any, any> {
content="序列号库仍在更新,请联系微信助手" content="序列号库仍在更新,请联系微信助手"
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorClose} confirm={this.onBindErrorConfirm}
></PopupAlert> ></PopupAlert>
<PopupAlert <PopupAlert
isShow={isBindingCheckError} isShow={isBindingCheckError}
@ -422,7 +442,6 @@ export default class Instrument extends Component<any, any> {
content="您选择的仪器有误,请重新选择确认" content="您选择的仪器有误,请重新选择确认"
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false}
close={this.onBindCheckErrorClose} close={this.onBindCheckErrorClose}
confirm={this.onBindCheckErrorClose} confirm={this.onBindCheckErrorClose}
></PopupAlert> ></PopupAlert>
@ -481,26 +500,35 @@ export default class Instrument extends Component<any, any> {
style="width: 100%; white-space: nowrap;" style="width: 100%; white-space: nowrap;"
scrollIntoView={"scroll" + channelInfo.id} scrollIntoView={"scroll" + channelInfo.id}
> >
{equipmentList.map((item, index) => { {equipmentList.length > 0 &&
return ( equipmentList.map((item, index) => {
<View return (
className={classnames("cover", { <View
active_cover: channelInfo.id === item.id, className={classnames("cover", {
})} active_cover: channelInfo.id === item.id,
id={"scroll" + item.id} })}
key={index} id={"scroll" + item.id}
onClick={this.onSelectChange.bind(this, item)} key={index}
> onClick={this.onSelectChange.bind(this, item)}
<Image >
className="instrument_img" <Image
src={item.banner} className="instrument_img"
mode="aspectFill" src={item.banner}
// mode="aspectFit" mode="aspectFill"
></Image> // mode="aspectFit"
<View className="desc">{item.name}</View> ></Image>
<View className="desc">{item.name}</View>
</View>
);
})}
{equipmentList.length === 0 && (
<Block>
<View>
<NoDataComponent />
</View> </View>
); </Block>
})} )}
</ScrollView> </ScrollView>
</View> </View>
<View className="form_item is-tab"> <View className="form_item is-tab">
@ -555,7 +583,7 @@ export default class Instrument extends Component<any, any> {
placeholder="例如FR10*********1" placeholder="例如FR10*********1"
placeholder-style={style} placeholder-style={style}
onInput={this.onSerial} onInput={this.onSerial}
value={channelInfo.serialCode} value={serialCodeValue}
></Input> ></Input>
</View> </View>
</View> </View>

@ -25,30 +25,29 @@ class Intro extends Component<any, any> {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
name: "template模板页", name: "仪器介绍页",
current: 0, current: 0,
instrument: {}, instrument: {},
introList: [], introList: [],
isNursing: false,
}; };
} }
$instance = Taro.getCurrentInstance(); $instance = Taro.getCurrentInstance();
async onLoad() {} async onLoad() {}
componentDidMount() {} componentDidMount() {
componentWillMount() {
// let params = Taro.Current?.router?.params;
// if (params) {
// this.getInstrumentInfo(params.id);
// }
let strObj = getStorageSync("instrument_detail"); let strObj = getStorageSync("instrument_detail");
if (strObj) { if (strObj) {
let instrument = JSON.parse(strObj); let instrument = strObj;
this.getInstrumentInfo(instrument.id); this.getInstrumentInfo(instrument.id);
this.setState({ instrument }); this.setState({ instrument });
} }
} }
componentWillMount() {
// let params = Taro.Current?.router?.params;
// if (params) {
// this.getInstrumentInfo(params.id);
// }
}
componentWillUnmount() {} componentWillUnmount() {}
componentDidShow() {} componentDidShow() {}
@ -64,35 +63,33 @@ class Intro extends Component<any, any> {
} }
// 获取设备信息 // 获取设备信息
async getInstrumentInfo(id) { getInstrumentInfo = async (id) => {
let res = await InstrumentInfo.instructionInfo({ let res = await InstrumentInfo.instructionInfo({
instrumentId: id, instrumentId: id,
}); });
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ introList: res.data.data }); this.setState({ introList: res.data.data });
} }
} };
toNursing() { /** 跳转至打卡页或护理页 */
// if (this.state.info.iot === 2) { toNursing = () => {
// this.setState({ isNursing: true }, () => { const { instrument } = this.state;
// this.toHomePage(); console.log("instrument", instrument);
// });
// } else {
// go("/pages/clock_in2/clock_in2?iid=" + this.state.info.id);
// }
}
toHomePage() { if (instrument.type === 1) {
// const { isNursing, info } = this.state; go("/pages/instrumentClickinUpload/index");
// if (isNursing) { } else {
// setStorageSync("introduceId", info.id); go("/pages/iotCarePlan/iotCarePlan");
// } }
};
toHomePage = () => {
const url = "/pages/index/index"; const url = "/pages/index/index";
Taro.switchTab({ Taro.switchTab({
url, url,
}); });
} };
customBack = () => { customBack = () => {
let customBack = this.$instance.router?.params?.customBack; let customBack = this.$instance.router?.params?.customBack;

@ -216,7 +216,8 @@ page {
.block1_1 { .block1_1 {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
width: 134rpx; // width: 134rpx;
min-width: 80rpx;
.icon { .icon {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;

@ -82,10 +82,9 @@ export default class InstrumentClickInUpload extends Component<any, any> {
componentDidHide() {} componentDidHide() {}
async initData() { async initData() {
let objStr = getStorageSync("instrument_detail"); let obj = getStorageSync("instrument_detail");
if (objStr) { if (obj) {
let instrumentDetail = JSON.parse(objStr); this.setState({ instrumentDetail: obj });
this.setState({ instrumentDetail });
} }
setTimeout(() => { setTimeout(() => {
this.firstNurseInfo(); this.firstNurseInfo();
@ -94,19 +93,24 @@ export default class InstrumentClickInUpload extends Component<any, any> {
}, 10); }, 10);
} }
// 打卡介绍 // 首次护理弹窗
firstNurseInfo = async () => { firstNurseInfo = async () => {
let { instrumentDetail } = this.state; let { instrumentDetail } = this.state;
let res = await InstrumentInfo.firstNurseInfo({ let res = await InstrumentInfo.firstNurseInfo({
instrumentId: instrumentDetail.id, instrumentId: instrumentDetail.id,
}); });
if (res.data.code === 200) { if (res.data.code === 200) {
let isTipShow = getStorageSync("first_instrument_" + instrumentDetail.id); // 仅在有数据的时候执行
if (!isTipShow) { if (res.data.length) {
// 首次进入页面:自动打开打卡介绍弹窗 let isTipShow = getStorageSync(
this.setState({ nurseInfo: res.data.data, isTipShow: true }); "first_instrument_" + instrumentDetail.id
} else { );
this.setState({ nurseInfo: res.data.data }); if (!isTipShow) {
// 首次进入页面:自动打开打卡介绍弹窗
this.setState({ nurseInfo: res.data.data, isTipShow: true });
} else {
this.setState({ nurseInfo: res.data.data });
}
} }
} }
}; };
@ -265,7 +269,11 @@ export default class InstrumentClickInUpload extends Component<any, any> {
}; };
onTipShowOpen = async () => { onTipShowOpen = async () => {
this.setState({ isTipShow: true }); if (this.state.nurseInfo.length) {
this.setState({ isTipShow: true });
} else {
msg("暂无数据");
}
}; };
onTipShowClose = async () => { onTipShowClose = async () => {
setStorageSync( setStorageSync(
@ -384,10 +392,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
}} }}
> >
<View className="block1"> <View className="block1">
<View <View className="block1_1 flex aitems ">
className="block1_1 flex aitems "
style="min-width: 80rpx"
>
<View className="tip1">{item.modeName}</View> <View className="tip1">{item.modeName}</View>
<View className="tip2">{item.modeDesc}</View> <View className="tip2">{item.modeDesc}</View>

@ -33,10 +33,9 @@ export default class InstrumentDetail extends Component<any, any> {
componentDidHide() {} componentDidHide() {}
async initData() { async initData() {
let objStr = getStorageSync("instrument_detail"); let obj = getStorageSync("instrument_detail");
if (objStr) { if (obj) {
let info = JSON.parse(objStr); this.bindingInstrumentInfo(obj.id);
this.bindingInstrumentInfo(info.id);
} }
} }

@ -87,39 +87,46 @@ export default class InstrumentManage extends Component<any, any> {
} }
}; };
goIntro(item) { goIntro = (item) => {
console.log("item", item);
setStorageSync("instrument_detail", item);
let bindid = item.id; let bindid = item.id;
go("/pages/introduce/introduce?id=" + bindid); go("/pages/instrument/intro?id=" + bindid);
} };
goBind(item) { goBind = (item) => {
let bindid = item.id; let bindid = item.id;
go("/pages/instrument/instrument?isOnly=true&id=" + bindid); // 只显示当前仪器内容 go("/pages/instrument/instrument?isOnly=true&id=" + bindid); // 只显示当前仪器内容
} };
goBindInfo(item) { goBindInfo = (item) => {
// let bindid = item.id; // let bindid = item.id;
setStorageSync("instrument_detail", JSON.stringify(item)); setStorageSync("instrument_detail", item);
go("/pages/instrument_detail/index"); go("/pages/instrument_detail/index");
} };
async lesgobuy(item) { lesgobuy = (item) => {
console.log(item); console.log(item);
// if (item.programs_json) { if (item.isPurchase === 1) {
// item.programs_json = JSON.parse(item.programs_json); if (item.programs_json) {
// // console.log(item.programs_json) item.programs_json = JSON.parse(item.programs_json);
// Taro.navigateToMiniProgram({ // console.log(item.programs_json)
// appId: item.programs_json.buylink, Taro.navigateToMiniProgram({
// path: item.programs_json.buypath, appId: item.programs_json.buylink,
// envVersion: "release", path: item.programs_json.buypath,
// success(res) { envVersion: "release",
// // 打开成功 success(res) {
// }, // 打开成功
// fail() {}, },
// }); fail() {},
// } else { });
// msg("暂无购买链接"); } else {
// } msg("暂无购买链接");
} }
} else {
msg("暂无购买链接");
}
};
render() { render() {
let { bindList, unBindList, current } = this.state; let { bindList, unBindList, current } = this.state;
@ -146,7 +153,10 @@ export default class InstrumentManage extends Component<any, any> {
return ( return (
<SwiperItem key={index}> <SwiperItem key={index}>
<View className="wrapper" key={"bind_" + index}> <View className="wrapper" key={"bind_" + index}>
<View className="cover" onClick={this.goIntro}> <View
className="cover"
onClick={this.goIntro.bind(this, item)}
>
<Image <Image
className="Image" className="Image"
src={item.banner} src={item.banner}
@ -154,7 +164,10 @@ export default class InstrumentManage extends Component<any, any> {
></Image> ></Image>
<View className="bind_status"></View> <View className="bind_status"></View>
<View className="intro"> <View className="intro">
<View className="tips" onClick={this.goIntro}> <View
className="tips"
onClick={this.goIntro.bind(this, item)}
>
</View> </View>
<View className="right"> <View className="right">
@ -184,51 +197,57 @@ export default class InstrumentManage extends Component<any, any> {
</View> </View>
</Block> </Block>
)} )}
<View className="title"></View>
<View className="scroll"> {/* 当且仅当未绑定仪器存在时显示 */}
<ScrollView scroll-x="true" className="un_bind_list"> {unBindList.length > 0 && (
{unBindList.map((item, index) => { <Block>
if (item.status === 0) { <View className="title"></View>
return ( <View className="scroll">
<View className="wrapper" key={index}> <ScrollView scroll-x="true" className="un_bind_list">
<View {unBindList.map((item, index) => {
className="cover" if (item.status === 0) {
onClick={this.lesgobuy.bind(this, item)} return (
> <View className="wrapper" key={index}>
<Image <View className="cover">
className="image"
src={item.banner}
mode="aspectFill"
></Image>
<View className="name">{item.name}</View>
<View
className="buy"
onClick={this.lesgobuy.bind(this, item)}
>
<View className="tips"></View>
<View className="right">
<Image <Image
src={require("../../img/index/right.png")} className="image"
mode="widthFix" src={item.banner}
style="height: 20rpx;" mode="aspectFill"
/> ></Image>
<View className="name">{item.name}</View>
{item.isPurchase === 1 && (
<View
className="buy"
onClick={this.lesgobuy.bind(this, item)}
>
<View className="tips"></View>
<View className="right">
<Image
src={require("../../img/index/right.png")}
mode="widthFix"
style="height: 20rpx;"
/>
</View>
</View>
)}
</View>
<View className="bind_cont">
<View
className="tobind"
onClick={this.goBind.bind(this, item)}
>
</View>
</View> </View>
</View> </View>
</View> );
<View className="bind_cont"> }
<View })}
className="tobind" </ScrollView>
onClick={this.goBind.bind(this, item)} </View>
> </Block>
)}
</View>
</View>
</View>
);
}
})}
</ScrollView>
</View>
</View> </View>
</Block> </Block>
); );

@ -255,18 +255,16 @@ class IotCarePlan extends Component<any, any> {
} }
async initData() { async initData() {
let objStr = getStorageSync("instrument_detail"); let obj = getStorageSync("instrument_detail");
if (objStr) { if (obj) {
let info = JSON.parse(objStr);
this.setState({ this.setState({
currentDevice: info, currentDevice: obj,
}); });
await this.GetModeList(info.id); await this.GetModeList(obj.id);
// 如果不存在设备模式值,则判断为首次进入,弹窗提示 // 如果不存在设备模式值,则判断为首次进入,弹窗提示
let isFirstTipShow = getStorageSync("first_instrument_" + info.id); let isFirstTipShow = getStorageSync("first_instrument_" + obj.id);
if (!isFirstTipShow) { if (!isFirstTipShow) {
this.firstNurseInfo(); this.firstNurseInfo();
} }

@ -163,6 +163,7 @@ class Register extends Component<any, any> {
componentDidHide() {} componentDidHide() {}
async initData() { async initData() {
console.log("MpSplashDetail Register");
const { data } = await MpSplashDetail({ const { data } = await MpSplashDetail({
pageNum: 1, pageNum: 1,
pageSize: 5, pageSize: 5,

@ -51,7 +51,6 @@ export const Ajax = (params) => {
}, },
data: params.data, data: params.data,
success(res) { success(res) {
// console.log("res", res);
if (res.data.code == 401 || res.data.code == 403) { if (res.data.code == 401 || res.data.code == 403) {
// 自动重新登录 // 自动重新登录
Taro.removeStorageSync("token"); Taro.removeStorageSync("token");
@ -59,14 +58,6 @@ export const Ajax = (params) => {
return; return;
} }
// if (res.statusCode !== 200) {
// Taro.showModal({
// title: "提示",
// content: String("错误码:" + res.statusCode),
// showCancel: false,
// });
// return false;
// }
if (res.data.code === 500) { if (res.data.code === 500) {
let msg = "系统异常,请联系管理人员"; let msg = "系统异常,请联系管理人员";
@ -148,7 +139,7 @@ export const AjaxUploadFile = (params, formData) => {
}); });
return false; return false;
} }
if (o.code !== 200) { if (o.code !== 200 && o.code !== 204 && o.code !== 205) {
let msg = let msg =
typeof o.msg == "string" ? o.msg : "系统异常,请联系管理人员"; typeof o.msg == "string" ? o.msg : "系统异常,请联系管理人员";
Taro.showModal({ Taro.showModal({
@ -217,7 +208,7 @@ export const AjaxFormData = (params) => {
}); });
return false; return false;
} }
if (res.data.code !== 200) { if (res.data.code !== 200 && o.code !== 204 && o.code !== 205) {
let msg = let msg =
typeof res.data.msg == "string" typeof res.data.msg == "string"
? res.data.msg ? res.data.msg

Loading…
Cancel
Save