|
|
|
|
@ -42,12 +42,7 @@ import {
|
|
|
|
|
// css引入
|
|
|
|
|
import "taro-ui/rn/style/components/calendar.scss";
|
|
|
|
|
import "./index.less";
|
|
|
|
|
import {
|
|
|
|
|
go,
|
|
|
|
|
goJump,
|
|
|
|
|
msg,
|
|
|
|
|
getStorageSync,
|
|
|
|
|
} from "@/utils/traoAPI";
|
|
|
|
|
import { go, goJump, msg, getStorageSync } from "@/utils/traoAPI";
|
|
|
|
|
|
|
|
|
|
class Index extends Component<any, any> {
|
|
|
|
|
// pageCtx = Taro.getCurrentInstance().page;
|
|
|
|
|
@ -56,6 +51,7 @@ class Index extends Component<any, any> {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
isRegisterBoolean: false, // 是否已登录
|
|
|
|
|
isShowPrivacyPopup: false,
|
|
|
|
|
isShowSiteSwiper: false,
|
|
|
|
|
isNotRegister: false, // 是否未注册
|
|
|
|
|
@ -90,11 +86,12 @@ class Index extends Component<any, any> {
|
|
|
|
|
bannerCurrent: 0,
|
|
|
|
|
|
|
|
|
|
/** 绑定仪器 */
|
|
|
|
|
isVisibleBinding: false,
|
|
|
|
|
isVisibleBinding: false, // 绑定弹窗
|
|
|
|
|
isBindingError: false, // 绑定失败
|
|
|
|
|
typeBinding: 0,
|
|
|
|
|
serial: "", // 仪器序列号
|
|
|
|
|
instrumentList: [], // 仪器列表
|
|
|
|
|
instrumentInfo: {
|
|
|
|
|
bindingStatus: 2,
|
|
|
|
|
bindingStatus: 0, // 绑定状态
|
|
|
|
|
createBy: null,
|
|
|
|
|
createTime: "2024-01-19 17:46:10",
|
|
|
|
|
exportFields: [],
|
|
|
|
|
@ -105,12 +102,12 @@ class Index extends Component<any, any> {
|
|
|
|
|
instrumentSerialIdList: [],
|
|
|
|
|
queryInstrumentIds: null,
|
|
|
|
|
remark: null,
|
|
|
|
|
serial: "1959895",
|
|
|
|
|
serial: "", // 设备序列号
|
|
|
|
|
source: "导入",
|
|
|
|
|
status: 0,
|
|
|
|
|
updateBy: null,
|
|
|
|
|
updateTime: null,
|
|
|
|
|
validStatus: 1,
|
|
|
|
|
validStatus: 1, // 有效状态
|
|
|
|
|
},
|
|
|
|
|
/** 绑定仪器 End */
|
|
|
|
|
};
|
|
|
|
|
@ -140,13 +137,33 @@ class Index extends Component<any, any> {
|
|
|
|
|
componentDidHide() {}
|
|
|
|
|
|
|
|
|
|
showInit() {
|
|
|
|
|
// 非扫码进入小程序,需判断是否跳转欢迎页;扫码进入小程序,直接检测隐私弹窗
|
|
|
|
|
if (!this.$instance.router?.params?.q) {
|
|
|
|
|
// 判断是否登录
|
|
|
|
|
let mobile = Taro.getStorageSync("mobile");
|
|
|
|
|
if (mobile) {
|
|
|
|
|
this.setState({ isRegisterBoolean: true });
|
|
|
|
|
}
|
|
|
|
|
// 非扫码进入小程序,需判断是否跳转欢迎页;扫码进入小程序,先缓存序列号,再检测隐私弹窗
|
|
|
|
|
let url = this.$instance.router?.params?.q || "";
|
|
|
|
|
if (!url) {
|
|
|
|
|
// 非扫码进入
|
|
|
|
|
Taro.setStorageSync("isScan", false);
|
|
|
|
|
const isFirst = Taro.getStorageSync("isWelcome");
|
|
|
|
|
if (isFirst) {
|
|
|
|
|
this.checkShowPrivacyPopup();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 扫码进入
|
|
|
|
|
Taro.setStorageSync("isScan", true);
|
|
|
|
|
if (url) {
|
|
|
|
|
let _url = decodeURIComponent(url);
|
|
|
|
|
if (_url.indexOf("?")) {
|
|
|
|
|
let ids = _url.split("?");
|
|
|
|
|
if (ids.length > 1) {
|
|
|
|
|
let serial = ids[1];
|
|
|
|
|
Taro.setStorageSync("serial", serial);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.checkShowPrivacyPopup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -185,14 +202,13 @@ class Index extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
initPageData() {
|
|
|
|
|
const mobile = Taro.getStorageSync("mobile");
|
|
|
|
|
|
|
|
|
|
this.GetSiteCarousel();
|
|
|
|
|
|
|
|
|
|
if (mobile) {
|
|
|
|
|
this.GetNoReadMessageNum(); // 查询是否有消息
|
|
|
|
|
|
|
|
|
|
// let url = this.$instance.router?.params?.q;
|
|
|
|
|
// if (url) {
|
|
|
|
|
// }
|
|
|
|
|
this.getInstrumentInfoBySerial();
|
|
|
|
|
this.getInstrumentInfoBySerial(); // 扫码序列号查询:注册后才调用,因为扫码未注册直接跳转注册页
|
|
|
|
|
this.bindingInstrumentList(); // 获取已绑定设备
|
|
|
|
|
|
|
|
|
|
if (!this.props.isShowIndexFlag) {
|
|
|
|
|
this.GetSitePopupList();
|
|
|
|
|
@ -228,7 +244,6 @@ class Index extends Component<any, any> {
|
|
|
|
|
GetSitePopupList = async () => {
|
|
|
|
|
let res = await GetSitePopupList(1);
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
// console.log("GetSitePopupList", res);
|
|
|
|
|
if (res.data.data) {
|
|
|
|
|
if (res.data.data.length) {
|
|
|
|
|
this.setState({
|
|
|
|
|
@ -280,8 +295,7 @@ class Index extends Component<any, any> {
|
|
|
|
|
} else {
|
|
|
|
|
Taro.setStorageSync("isInstrumentJump", "false"); // 重置
|
|
|
|
|
}
|
|
|
|
|
let mobile = Taro.getStorageSync("mobile");
|
|
|
|
|
if (!mobile) {
|
|
|
|
|
if (!this.state.isRegisterBoolean) {
|
|
|
|
|
this.alertRegister();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -303,12 +317,6 @@ class Index extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
public alertRegister = () => {
|
|
|
|
|
this.setState({ isNotRegister: true }); // 打开弹窗
|
|
|
|
|
// if (!this.props.mobile) {
|
|
|
|
|
// this.setState({ isNotRegister: true }); // 打开弹窗
|
|
|
|
|
// return;
|
|
|
|
|
// } else {
|
|
|
|
|
// go("/pages/instrument/instrument");
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onTimeChange = (value) => {
|
|
|
|
|
@ -354,8 +362,22 @@ class Index extends Component<any, any> {
|
|
|
|
|
goJump(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 扫码进入逻辑 */
|
|
|
|
|
//
|
|
|
|
|
/* 仪器与是否扫码进入逻辑 */
|
|
|
|
|
// 获取已绑定仪器列表
|
|
|
|
|
bindingInstrumentList = async () => {
|
|
|
|
|
Taro.showLoading({
|
|
|
|
|
title: "请求中...",
|
|
|
|
|
mask: true,
|
|
|
|
|
});
|
|
|
|
|
let { instrumentInfo } = this.state;
|
|
|
|
|
let { data } = await InstrumentInfo.bindingInstrumentList();
|
|
|
|
|
console.log("bindingInstrument", data);
|
|
|
|
|
Taro.hideLoading();
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
this.setState({ instrumentList: data.data });
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 是否扫码进入小程序
|
|
|
|
|
isSancQrcodeEnter = async () => {
|
|
|
|
|
let instance = Taro.getCurrentInstance();
|
|
|
|
|
@ -374,11 +396,12 @@ class Index extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
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);
|
|
|
|
|
Taro.hideLoading();
|
|
|
|
|
|
|
|
|
|
this.initPageData();
|
|
|
|
|
} else {
|
|
|
|
|
@ -386,42 +409,88 @@ class Index extends Component<any, any> {
|
|
|
|
|
this.WCUserLogin();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closeBinding() {
|
|
|
|
|
closeBinding = () => {
|
|
|
|
|
this.setState({ isVisibleBinding: false });
|
|
|
|
|
}
|
|
|
|
|
confirmBinding() {
|
|
|
|
|
this.setState({ isVisibleBinding: false });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
confirmBinding = () => {
|
|
|
|
|
let { instrumentInfo } = this.state;
|
|
|
|
|
// 0未绑定 1 2
|
|
|
|
|
if (instrumentInfo.bindingStatus === 0) {
|
|
|
|
|
this.bindingInstrument();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 根据扫码的序列号获取仪器信息
|
|
|
|
|
getInstrumentInfoBySerial = async () => {
|
|
|
|
|
let url = this.$instance.router?.params?.q;
|
|
|
|
|
if (url) {
|
|
|
|
|
let _url = decodeURIComponent(url);
|
|
|
|
|
if (_url.indexOf("?")) {
|
|
|
|
|
let ids = _url.split("?");
|
|
|
|
|
if (ids.length > 1) {
|
|
|
|
|
let serial = ids[1];
|
|
|
|
|
let { data } = await InstrumentInfo.getInstrumentInfoBySerial({
|
|
|
|
|
serial: serial,
|
|
|
|
|
});
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
console.log("Data", data);
|
|
|
|
|
this.setState({ serial });
|
|
|
|
|
}
|
|
|
|
|
let url = this.$instance.router?.params?.q || "";
|
|
|
|
|
let isScan = Taro.getStorageSync("isScan"); // 判断是否扫码进入
|
|
|
|
|
let serial = Taro.getStorageSync("serial"); // 扫码可能跳转注册页,所以先缓存
|
|
|
|
|
if (url || isScan) {
|
|
|
|
|
let { data } = await InstrumentInfo.getInstrumentInfoBySerial({
|
|
|
|
|
serial: serial,
|
|
|
|
|
});
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
Taro.removeStorageSync("isScan");
|
|
|
|
|
Taro.removeStorageSync("serial"); // 获取成功,以后删除缓存的扫码序列号
|
|
|
|
|
let isVisibleBinding = false;
|
|
|
|
|
if (data.data.bindingStatus === 0) {
|
|
|
|
|
isVisibleBinding = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新扫码进入仪器信息
|
|
|
|
|
this.setState({
|
|
|
|
|
isVisibleBinding,
|
|
|
|
|
instrumentInfo: data.data,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 获取失败和绑定失败一个弹窗
|
|
|
|
|
this.setState({ isBindingError: true });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 绑定仪器
|
|
|
|
|
bindingInstrument = async () => {
|
|
|
|
|
let { serial } = this.state;
|
|
|
|
|
Taro.showLoading({
|
|
|
|
|
title: "请求中...",
|
|
|
|
|
mask: true,
|
|
|
|
|
});
|
|
|
|
|
let { instrumentInfo } = this.state;
|
|
|
|
|
let { data } = await InstrumentInfo.binding({
|
|
|
|
|
serial: serial,
|
|
|
|
|
serial: instrumentInfo.serial,
|
|
|
|
|
});
|
|
|
|
|
console.log("bindingInstrument", data);
|
|
|
|
|
Taro.hideLoading();
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
console.log("binding", data);
|
|
|
|
|
this.setState({ isVisibleBinding: false });
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ isBindingError: true });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exchangeBinding = async () => {
|
|
|
|
|
Taro.showLoading({
|
|
|
|
|
title: "请求中...",
|
|
|
|
|
mask: true,
|
|
|
|
|
});
|
|
|
|
|
let { instrumentInfo } = this.state;
|
|
|
|
|
let { data } = await InstrumentInfo.exchangeBinding({
|
|
|
|
|
serial: instrumentInfo.serial,
|
|
|
|
|
});
|
|
|
|
|
console.log("exchangeBinding", data);
|
|
|
|
|
Taro.hideLoading();
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
this.setState({ isVisibleBinding: false });
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ isBindingError: true });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onBindErrorClose = () => {
|
|
|
|
|
this.setState({ isBindingError: false });
|
|
|
|
|
};
|
|
|
|
|
onBindErrorConfirm = () => {
|
|
|
|
|
this.onBindErrorClose();
|
|
|
|
|
go("/pages/consultant/consultant");
|
|
|
|
|
};
|
|
|
|
|
// InstrumentInfo
|
|
|
|
|
/* 扫码进入逻辑 */
|
|
|
|
|
|
|
|
|
|
@ -441,7 +510,10 @@ class Index extends Component<any, any> {
|
|
|
|
|
bannerCurrent,
|
|
|
|
|
// 绑定弹窗
|
|
|
|
|
isVisibleBinding,
|
|
|
|
|
isBindingError,
|
|
|
|
|
isRegisterBoolean,
|
|
|
|
|
typeBinding,
|
|
|
|
|
instrumentInfo,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -472,11 +544,23 @@ class Index extends Component<any, any> {
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupBinding
|
|
|
|
|
type={typeBinding}
|
|
|
|
|
type={instrumentInfo.bindingStatus}
|
|
|
|
|
isShow={isVisibleBinding}
|
|
|
|
|
isRegisterBoolean={isRegisterBoolean}
|
|
|
|
|
data={instrumentInfo}
|
|
|
|
|
close={this.closeBinding}
|
|
|
|
|
confirm={this.confirmBinding}
|
|
|
|
|
/>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isBindingError}
|
|
|
|
|
title="提示"
|
|
|
|
|
content="序列号库仍在更新,请联系微信助手"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
isClose={false}
|
|
|
|
|
close={this.onBindErrorClose}
|
|
|
|
|
confirm={this.onBindErrorConfirm}
|
|
|
|
|
></PopupAlert>
|
|
|
|
|
|
|
|
|
|
{/* <PopupPrivacyTest
|
|
|
|
|
closePrivacy={this.closePrivacy.bind(this)}
|
|
|
|
|
@ -517,7 +601,6 @@ class Index extends Component<any, any> {
|
|
|
|
|
src={require("../../img/index/right.png")}
|
|
|
|
|
style="width: 20rpx;height: 20rpx;"
|
|
|
|
|
/>
|
|
|
|
|
{/* <View className="at-icon at-icon-chevron-right"></View> */}
|
|
|
|
|
</View>
|
|
|
|
|
<View className="bg-while">
|
|
|
|
|
<AtCalendar
|
|
|
|
|
@ -561,53 +644,6 @@ class Index extends Component<any, any> {
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{/* <View className="infobox7">
|
|
|
|
|
<View className="nurse_recommend_box flex aitems sb">
|
|
|
|
|
<View className="title">护理推荐</View>
|
|
|
|
|
<View className="txt_box flex jcenter aitems" data-url="/pages/care_plan/list/list" onClick={this.goCarePlanList}>
|
|
|
|
|
<View className="txt">更多</View>
|
|
|
|
|
<Image className="right_icon" src="/img/index-right.png" mode="aspectFill"></Image>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<ScrollView className="scroll_View" enable-flex scroll-x>
|
|
|
|
|
<View className="recommend_list flex">
|
|
|
|
|
<Block wx:for="{{carePlanList}}" wx:key="index">
|
|
|
|
|
<View className="recommend_item" data-url="/pages/care_plan/detail/detail?id={{item.id}}" onClick={this.gourl}>
|
|
|
|
|
<Image className="banner_img" src={imgUrl+item.indexBanner} mode="aspectFill"></Image>
|
|
|
|
|
<View className="bottom flex sb fc">
|
|
|
|
|
<View className="title ellipsis2">{{item.title}}</View>
|
|
|
|
|
<View className="join_in {{carePlan.activity.id==item.id&&carePlan.join.status==1?'disabled':''}}">
|
|
|
|
|
<Block wx:if="{{carePlan.activity.id===item.id&&carePlan.join.status==1}}">参与中</Block>
|
|
|
|
|
<Block wx:else>参与</Block>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
</Block>
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
</View> */}
|
|
|
|
|
|
|
|
|
|
{/* {bannerList.length && (
|
|
|
|
|
<View className="infobox3">
|
|
|
|
|
<Swiper
|
|
|
|
|
autoplay={true}
|
|
|
|
|
onAnimationFinish={this.bannerSwiperchange.bind(this)}
|
|
|
|
|
current={bannerCurrent}
|
|
|
|
|
>
|
|
|
|
|
{bannerList.map((item, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<SwiperItem
|
|
|
|
|
key={"banner_" + index}
|
|
|
|
|
onClick={this.gobanner.bind(this)}
|
|
|
|
|
data-item={item}
|
|
|
|
|
>
|
|
|
|
|
<Image src={item.fileUrl} />
|
|
|
|
|
</SwiperItem>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Swiper>
|
|
|
|
|
</View>
|
|
|
|
|
)} */}
|
|
|
|
|
<View className="infobox3">
|
|
|
|
|
<Swiper
|
|
|
|
|
autoplay={true}
|
|
|
|
|
|