绑定流程临时提交

master
blak-kong 2 years ago
parent 30a84112b7
commit 92c3ed2fd1

@ -17,7 +17,7 @@ Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN
2. 下载项目依赖 2. 下载项目依赖
```javascript ```javascript
npm i -f // 强制下载安装依赖 npm i -f // 强制下载安装依赖 注意请使用npm源taobao源可能下载失败
``` ```
3. 启动与打包命令 3. 启动与打包命令

61901
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -61,7 +61,9 @@
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-redux": "^9.0.3", "react-redux": "^9.0.3",
"taro-ui": "^3.2.0", "taro-ui": "^3.2.0",
"terser-webpack-plugin": "^5.3.9" "terser-webpack-plugin": "^5.3.9",
"@flossom-npm/iot-translater": "^1.0.8",
"@flossom-npm/iot-translater-we100": "^1.0.66"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",

@ -13,6 +13,7 @@ export default defineAppConfig({
'pages/userInfoDetail/userInfoDetail', 'pages/userInfoDetail/userInfoDetail',
"pages/register/register", "pages/register/register",
'pages/instrument/instrument', 'pages/instrument/instrument',
"pages/instrument/intro",
'pages/privacyPolicy/privacyPolicy', 'pages/privacyPolicy/privacyPolicy',
'pages/userPolicy/userPolicy', 'pages/userPolicy/userPolicy',
'pages/about/about', 'pages/about/about',

@ -70,6 +70,7 @@ export default class PopupBinding extends Component<any, any> {
let { let {
title, title,
data, data,
isExchangeBinding,
content, content,
cancelButtonText, cancelButtonText,
confirmButtonText, confirmButtonText,
@ -80,8 +81,19 @@ export default class PopupBinding extends Component<any, any> {
type, type,
} = this.props; } = this.props;
let serial = Taro.getStorageSync("serial"); // let serial = Taro.getStorageSync("serial");
let isSerial = String(serial) === String(data.serial) ? true : false; // let isSerial = String(serial) === String(data.serial) ? true : false;
// let isDuplicateName = false;
// if (instrumentList.length) {
// let instrumentNameIndex = instrumentList.findIndex(
// (item) => item.instrumentName === data.instrumentName
// );
// if (instrumentNameIndex > -1) {
// isDuplicateName = true;
// }
// }
return ( return (
<Block> <Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} /> <PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
@ -107,49 +119,55 @@ export default class PopupBinding extends Component<any, any> {
></PopupAlert> ></PopupAlert>
)} )}
{isRegisterBoolean && (type === 1 || type === 2) && ( {isRegisterBoolean &&
<PopupConfirm (type === 1 || type === 2) &&
isShow={isShow} !isExchangeBinding && (
isClose={false} <PopupConfirm
title="提示" isShow={isShow}
content={ isClose={false}
<Block> title="提示"
<View className={classnames("text-center")}> content={
<View>{data.instrumentName}</View> <Block>
<View style="margin-top:20rpx">{data.serial}</View> <View className={classnames("text-center")}>
<View style="margin-top:20rpx"></View> <View>{data.instrumentName}</View>
</View> <View style="margin-top:20rpx">{data.serial}</View>
</Block> <View style="margin-top:20rpx">
}
confirmButtonText="确认" </View>
cancelButtonText="暂不绑定"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
{isRegisterBoolean && type === 2 && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx">
<View></View>
<View></View>
</View> </View>
</View> </Block>
</Block> }
} confirmButtonText="确认"
confirmButtonText="确认" cancelButtonText="暂不绑定"
cancelButtonText="暂不换绑" close={this.onClose}
close={this.onClose} confirm={this.onConfirm}
confirm={this.onConfirm} ></PopupConfirm>
></PopupConfirm> )}
)} {isRegisterBoolean &&
(type === 1 || type === 2) &&
isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
content={
<Block>
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx">
<View></View>
<View></View>
</View>
</View>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不换绑"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
</Block> </Block>
); );
} }

@ -15,6 +15,7 @@ import {
import { connect } from "react-redux"; import { connect } from "react-redux";
import { userRefresh, tokenRefresh } from "../../store/features/userInfo"; import { userRefresh, tokenRefresh } from "../../store/features/userInfo";
import { setIndexFlag } from "../../store/features/globalStore"; import { setIndexFlag } from "../../store/features/globalStore";
import { setInstrument } from "../../store/features/instrument";
/*** redux end ***/ /*** redux end ***/
/** 自定义组件 **/ /** 自定义组件 **/
@ -88,10 +89,12 @@ class Index extends Component<any, any> {
/** 绑定仪器 */ /** 绑定仪器 */
isVisibleBinding: false, // 绑定弹窗 isVisibleBinding: false, // 绑定弹窗
isBindingError: false, // 绑定失败 isBindingError: false, // 绑定失败
isBeforeBinding: false, // 已绑定弹窗
typeBinding: 0, typeBinding: 0,
instrumentList: [], // 仪器列表 instrumentList: [], // 仪器列表
instrumentInfo: { instrumentInfo: {
bindingStatus: 0, // 绑定状态 // 扫码获得的序列号仪器
bindingStatus: 0, // 0已绑定1未绑定2已解绑
createBy: null, createBy: null,
createTime: "2024-01-19 17:46:10", createTime: "2024-01-19 17:46:10",
exportFields: [], exportFields: [],
@ -104,10 +107,10 @@ class Index extends Component<any, any> {
remark: null, remark: null,
serial: "", // 设备序列号 serial: "", // 设备序列号
source: "导入", source: "导入",
status: 0, status: 0, // 0正常 1停用
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
validStatus: 1, // 有效状态 validStatus: 1, // 1有效0无效
}, },
/** 绑定仪器 End */ /** 绑定仪器 End */
}; };
@ -200,14 +203,14 @@ class Index extends Component<any, any> {
} }
} }
initPageData() { async initPageData() {
const mobile = Taro.getStorageSync("mobile"); const mobile = Taro.getStorageSync("mobile");
this.GetSiteCarousel(); this.GetSiteCarousel();
if (mobile) { if (mobile) {
this.GetNoReadMessageNum(); // 查询是否有消息 this.GetNoReadMessageNum(); // 查询是否有消息
this.getInstrumentInfoBySerial(); // 扫码序列号查询:注册后才调用,因为扫码未注册直接跳转注册页 await this.bindingInstrumentList(); // 获取已绑定设备
this.bindingInstrumentList(); // 获取已绑定设备 await this.getInstrumentInfoBySerial(); // 扫码序列号查询:注册后才调用,因为扫码未注册直接跳转注册页
if (!this.props.isShowIndexFlag) { if (!this.props.isShowIndexFlag) {
this.GetSitePopupList(); this.GetSitePopupList();
@ -250,8 +253,6 @@ class Index extends Component<any, any> {
isShowSiteSwiper: true, isShowSiteSwiper: true,
}); });
} }
} else {
// msg("暂无数据");
} }
} }
}; };
@ -366,13 +367,12 @@ class Index extends Component<any, any> {
title: "请求中...", title: "请求中...",
mask: true, mask: true,
}); });
// let { instrumentInfo } = this.state; let { data: res } = await InstrumentInfo.bindingInstrumentList();
let { data } = await InstrumentInfo.bindingInstrumentList();
console.log("bindingInstrumentList", data);
Taro.hideLoading(); Taro.hideLoading();
if (data.code === 200) { if (res.code === 200) {
this.setState({ instrumentList: data.data }); this.setState({ instrumentList: res.data });
} else { } else {
// 仪器列表失败todo
} }
}; };
// 是否扫码进入小程序 // 是否扫码进入小程序
@ -407,11 +407,20 @@ class Index extends Component<any, any> {
} }
} }
closeBinding = () => { closeBinding = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
this.setState({ isVisibleBinding: false }); this.setState({ isVisibleBinding: false });
}; };
confirmBinding = () => { confirmBinding = () => {
// let { instrumentInfo } = this.state; let { isExchangeBinding } = this.state;
this.bindingInstrument();
if (!isExchangeBinding) {
// 绑定仪器
this.bindingInstrument();
} else {
// 换绑仪器
this.bindingInstrument();
}
}; };
// 根据扫码的序列号获取仪器信息 // 根据扫码的序列号获取仪器信息
getInstrumentInfoBySerial = async () => { getInstrumentInfoBySerial = async () => {
@ -423,33 +432,55 @@ class Index extends Component<any, any> {
serial: serial, serial: serial,
}); });
if (data.code === 200) { if (data.code === 200) {
Taro.removeStorageSync("isScan");
Taro.removeStorageSync("serial"); // 获取成功,以后删除缓存的扫码序列号
let isVisibleBinding = false;
let instrumentInfo = data.data; let instrumentInfo = data.data;
// 更新扫码进入仪器信息
this.setState({ instrumentInfo: instrumentInfo });
// 1有效 0无效 // 1有效 0无效
if (instrumentInfo.validStatus === 0) { if (instrumentInfo.validStatus === 0) {
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
return;
} }
// 0已绑定 1未绑定 2已解绑 // 0已绑定 1未绑定 2已解绑
if ( if (instrumentInfo.bindingStatus === 0) {
this.setState({
isBeforeBinding: true,
});
return;
} else if (
instrumentInfo.bindingStatus === 1 || instrumentInfo.bindingStatus === 1 ||
instrumentInfo.bindingStatus === 2 instrumentInfo.bindingStatus === 2
) { ) {
isVisibleBinding = true; setTimeout(() => {
this.isBindingSerial();
}, 100);
} }
// 更新扫码进入仪器信息
this.setState({
isVisibleBinding,
instrumentInfo: instrumentInfo,
});
} else { } else {
// 获取失败和绑定失败一个弹窗 // 获取失败和绑定失败一个弹窗
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }
} }
}; };
isBindingSerial = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { instrumentInfo } = this.state;
let res = await InstrumentInfo.isBindingSerial({
serial: instrumentInfo.serial,
});
console.log("isBindingSerial", res);
if (res.data.code === 201) {
// 绑定
this.setState({ isExchangeBinding: false, isVisibleBinding: true });
} else if (res.data.code === 202) {
// 换绑
this.setState({ isExchangeBinding: true, isVisibleBinding: true });
}
Taro.hideLoading();
};
// 绑定仪器 // 绑定仪器
bindingInstrument = async () => { bindingInstrument = async () => {
Taro.showLoading({ Taro.showLoading({
@ -460,11 +491,24 @@ class Index extends Component<any, any> {
let { data } = await InstrumentInfo.binding({ let { data } = await InstrumentInfo.binding({
serial: instrumentInfo.serial, serial: instrumentInfo.serial,
}); });
console.log("bindingInstrument", data);
Taro.hideLoading(); Taro.hideLoading();
this.closeBinding();
if (data.code === 200) { if (data.code === 200) {
this.setState({ isVisibleBinding: false }); msg("绑定成功");
setTimeout(() => {
go("/pages/instrument/intro?id=" + instrumentInfo.id);
}, 2000);
return;
} else if (data.code === 202) {
// 换绑操作
this.closeBinding();
this.setState({ isExchangeBinding: true, isVisibleBinding: true });
} else if (data.code === 201) {
// 跳转联系客服
this.closeBinding();
this.setState({ isBindingError: true });
} else { } else {
this.closeBinding();
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }
}; };
@ -481,12 +525,13 @@ class Index extends Component<any, any> {
console.log("exchangeBinding", data); console.log("exchangeBinding", data);
Taro.hideLoading(); Taro.hideLoading();
if (data.code === 200) { if (data.code === 200) {
this.setState({ isVisibleBinding: false }); this.closeBinding();
} else { } else {
this.closeBinding();
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }
}; };
// 仪器绑定失败弹窗
onBindErrorClose = () => { onBindErrorClose = () => {
this.setState({ isBindingError: false }); this.setState({ isBindingError: false });
}; };
@ -494,7 +539,19 @@ class Index extends Component<any, any> {
this.onBindErrorClose(); this.onBindErrorClose();
go("/pages/consultant/consultant"); go("/pages/consultant/consultant");
}; };
// InstrumentInfo onBeforeBindClose = () => {
this.setState({ isBeforeBinding: false });
};
onBeforeBindConfirm = () => {
this.setState({ isBeforeBinding: false });
};
// 跳转仪器介绍页
goNursing = (item) => {
console.log("goNursing", item);
this.props.setInstrument(item);
go("/pages/instrument/intro?id=" + item.id);
};
/* 扫码进入逻辑 */ /* 扫码进入逻辑 */
render() { render() {
@ -514,9 +571,12 @@ class Index extends Component<any, any> {
// 绑定弹窗 // 绑定弹窗
isVisibleBinding, isVisibleBinding,
isBindingError, isBindingError,
isBeforeBinding,
isRegisterBoolean, isRegisterBoolean,
isExchangeBinding,
typeBinding, typeBinding,
instrumentInfo, instrumentInfo,
instrumentList,
} = this.state; } = this.state;
return ( return (
@ -550,6 +610,7 @@ class Index extends Component<any, any> {
type={instrumentInfo.bindingStatus} type={instrumentInfo.bindingStatus}
isShow={isVisibleBinding} isShow={isVisibleBinding}
isRegisterBoolean={isRegisterBoolean} isRegisterBoolean={isRegisterBoolean}
isExchangeBinding={isExchangeBinding}
data={instrumentInfo} data={instrumentInfo}
close={this.closeBinding} close={this.closeBinding}
confirm={this.confirmBinding} confirm={this.confirmBinding}
@ -557,13 +618,28 @@ class Index extends Component<any, any> {
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}
title="提示" title="提示"
content="序列号库仍在更新,请联系微信助手" content={
<Block>
<View></View>
<View></View>
</Block>
}
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false} isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
></PopupAlert> ></PopupAlert>
<PopupAlert
isShow={isBeforeBinding}
title="提示"
content="您选择的仪器有误,请重新确认选择"
confirmButtonText="知道了"
textAlgin="center"
isClose={false}
close={this.onBeforeBindClose}
confirm={this.onBeforeBindConfirm}
></PopupAlert>
{/* <PopupPrivacyTest {/* <PopupPrivacyTest
closePrivacy={this.closePrivacy.bind(this)} closePrivacy={this.closePrivacy.bind(this)}
@ -618,33 +694,70 @@ class Index extends Component<any, any> {
</View> </View>
</View> </View>
<View className="infobox5"> <View className="infobox5">
<View {instrumentList.length > 0 && (
className={classnames("nurse_plan_box", "flex", "aitems", "sb")} <Block>
> <View className="nurse_plan_box flex aitems sb">
<View className="title"></View> <View className="title"></View>
</View>
<View
className={classnames(
"add_device",
"flex",
"jcenter",
"aitems",
"bg-while"
)}
>
<View className="add_device_btn">
<View className="txt_box flex jcenter aitems">
<View <View
className="at-icon at-icon-add" className="txt_box flex jcenter aitems"
style="color: #fff;font-size: 30rpx;" data-url="/pages/instrument/instrument"
></View> onClick={this.gourl}
<View className="txt" onClick={this.addNewDevice}> >
<Image
className="right_icon"
src={require("../../img/black-add.png")}
mode="aspectFill"
/>
<View className="txt"></View>
</View> </View>
</View> </View>
</View> <View style="overflow-x: auto;">
<View className="tips"></View> <View className="device_list flex">
</View> {instrumentList.map((item, index) => {
if (item.status === 0) {
return (
<View
key={"instrumentList" + index}
className="device_item"
onClick={this.goNursing.bind(this, item)}
>
<Image
className="banner_img"
src={item.banner}
mode="aspectFill"
/>
<View className="device_name ellipsis1">
{item.name}
</View>
</View>
);
}
})}
</View>
</View>
</Block>
)}
{instrumentList.length === 0 && (
<Block>
<View className="nurse_plan_box flex aitems sb">
<View className="title"></View>
</View>
<View className="add_device flex jcenter aitems bg-while">
<View className="add_device_btn">
<View className="txt_box flex jcenter aitems">
<View
className="at-icon at-icon-add"
style="color: #fff;font-size: 30rpx;"
></View>
<View className="txt" onClick={this.addNewDevice}>
</View>
</View>
</View>
<View className="tips"></View>
</View>
</Block>
)}
</View> </View>
<View className="infobox3"> <View className="infobox3">
@ -686,5 +799,8 @@ const mapDispatchToProps = (dispatch) => ({
setIndexFlag(data) { setIndexFlag(data) {
dispatch(setIndexFlag(data)); dispatch(setIndexFlag(data));
}, },
setInstrument(data) {
dispatch(setInstrument(data));
},
}); });
export default connect(mapStateToProps, mapDispatchToProps)(Index); export default connect(mapStateToProps, mapDispatchToProps)(Index);

@ -349,7 +349,7 @@ export default class Instrument extends Component<any, any> {
} = this.state; } = this.state;
return ( return (
<Block> <Block>
<PopupAlert {/* <PopupAlert
isShow={true} isShow={true}
isClose={true} isClose={true}
title="提示" title="提示"
@ -358,7 +358,7 @@ export default class Instrument extends Component<any, any> {
textAlgin="center" textAlgin="center"
close={this.closeDev} close={this.closeDev}
confirm={this.closeDev} confirm={this.closeDev}
/> /> */}
<Navbar titleSlot="仪器绑定" isBack={true} /> <Navbar titleSlot="仪器绑定" isBack={true} />
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}

@ -0,0 +1,78 @@
.footer {
position: fixed;
bottom: 0;
background: #fff;
flex-direction: column;
width: 100%;
padding-bottom: 20rpx;
/*padding-bottom: env(safe-area-inset-bottom);*/
}
.footer .btn {
width: 690rpx;
height: 90rpx;
background: #000;
border-radius: 45rpx;
color: #fff;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
}
.footer .text {
background: transparent;
color: #000;
}
.main {
height: 100vh;
text-align: center;
margin: 48rpx 45rpx 0;
padding-bottom: calc(env(safe-area-inset-bottom) + 180rpx);
}
.cover {
width: 660rpx;
height: 922rpx;
border-radius: 50rpx;
}
.content {
width: 660rpx;
height: 474rpx;
background: linear-gradient(rgba(204, 204, 204, 0.4), #fff);
border-radius: 50rpx;
margin-top: 7rpx;
}
.title {
font-size: 48rpx;
font-weight: 500;
color: #000;
text-align: center;
padding-bottom: 48rpx;
padding-top: 96rpx;
}
.text {
font-size: 26rpx;
font-weight: 500;
color: #666;
}
.indicator {
position: absolute;
left: 50%;
top: 960rpx;
transform: translate(-50%, -50%);
width: 120rpx;
height: 1rpx;
background: #ccc;
}
.dot {
height: 100%;
background: #000;
transition-property: all;
transition-duration: 0.8s;
}

@ -0,0 +1,153 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import {
Block,
View,
Text,
Image,
Video,
Input,
Button,
Swiper,
SwiperItem,
} from "@tarojs/components";
import { InstrumentInfo } from "../../utils/Interface";
import { setStorageSync, getStorageSync, go } from "../../utils/traoAPI";
import util from "../../utils/utilhtml";
import "./intro.less";
export default class Intro extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "template模板页",
current: 0,
info: {},
introList: [],
isNursing: false,
};
}
async onLoad() {}
componentDidMount() {}
componentWillMount() {
console.log("Taro.Current", Taro.Current);
let params = Taro.Current?.router?.params;
if (params) {
this.getInstrumentInfo(params.id);
}
}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
onChange(event) {
console.info("onchange", event);
const current = event.detail.current;
this.setState({ current });
}
// 获取设备信息
async getInstrumentInfo(id) {
// const { data: res } = await InstrumentInfo({ id });
let { data: res } = await InstrumentInfo.instructionInfo({
instrumentId: id,
});
console.log("instrumentId", res);
// if (res.code === 200) {
// const { intro_json } = res.data.info;
// if (intro_json) {
// try {
// res.data.info.intro_json = JSON.parse(intro_json);
// } catch (e) {
// console.log(e);
// }
// }
// this.setState({
// info: res.data?.info,
// introList: res.data?.info?.intro_json,
// });
// }
}
toNursing() {
if (this.state.info.iot === 2) {
this.setState({ isNursing: true }, () => {
this.toHomePage();
});
} else {
go("/pages/clock_in2/clock_in2?iid=" + this.state.info.id);
}
}
toHomePage() {
const { isNursing, info } = this.state;
if (isNursing) {
// isNursing ? '/pages/index/index?instrument_id=' + info.id
setStorageSync("introduceId", info.id);
}
const url = "/pages/index/index";
Taro.switchTab({
url,
});
}
render() {
let { name, current, introList, info } = this.state;
return (
<Block>
<View style="position: relative">
<Swiper className="main" current={current} onChange={this.onChange}>
{introList.map((item: any, index: number) => {
return (
<SwiperItem key={index}>
{item.fileType === "video" ? (
<Video className="cover" src={item.file} />
) : (
<Image
className="cover"
src={item.file}
mode="aspectFill"
></Image>
)}
<View className="content">
<View className="title">{info.titile}</View>
<View className="text">{item.title}</View>
</View>
</SwiperItem>
);
})}
</Swiper>
<View className="indicator">
<View
className="dot"
style={{
transform:
"translateX(" + (current * 120) / introList.length + "rpx)",
width: "calc(100% / " + introList.length + ")",
}}
></View>
</View>
</View>
<View className="footer flex aitems jcenter">
<View className="btn" onClick={this.toNursing}>
</View>
<View className="btn text" onClick={this.toHomePage}>
</View>
</View>
</Block>
);
}
}

@ -50,11 +50,6 @@ class Register extends Component<any, any> {
} }
onSkip = () => { onSkip = () => {
const isScan = Taro.getStorageSync("isScan");
if (isScan) {
Taro.setStorageSync("isScanNotRegisterSkip", true);
}
Taro.reLaunch({ Taro.reLaunch({
url: "/pages/index/index", url: "/pages/index/index",
}); });

@ -174,7 +174,6 @@ class UserInfo extends Component<any, any> {
this.setState({ isShowIntegralText: true }); this.setState({ isShowIntegralText: true });
} else { } else {
msg("更新成功"); msg("更新成功");
// this.goUser();
this.onSkip(); this.onSkip();
} }
} }
@ -209,19 +208,12 @@ class UserInfo extends Component<any, any> {
this.setState({ isShowIntegralText: true }); this.setState({ isShowIntegralText: true });
} else { } else {
msg("更新成功"); msg("更新成功");
// this.goUser();
this.onSkip(); this.onSkip();
} }
} }
} }
}; };
goUser = () => {
Taro.reLaunch({
url: "/pages/user/user",
});
};
getChooseAvatar = (event) => { getChooseAvatar = (event) => {
console.log("getChooseAvatar", event); console.log("getChooseAvatar", event);
@ -264,6 +256,15 @@ class UserInfo extends Component<any, any> {
}; };
onSkip = () => { onSkip = () => {
// 仅注册账号进入个人信息完善页。此时判断是否扫码进入的小程序,如果是扫码进入,提交与跳过都是回到主页
const isScan = Taro.getStorageSync("isScan");
if (isScan) {
// Taro.setStorageSync("isScanNotRegisterSkip", true);
Taro.reLaunch({
url: "/pages/index/index",
});
return;
}
let isInstrumentJump = Taro.getStorageSync("isInstrumentJump"); let isInstrumentJump = Taro.getStorageSync("isInstrumentJump");
if (isInstrumentJump === "true") { if (isInstrumentJump === "true") {
go("/pages/instrument/instrument"); go("/pages/instrument/instrument");
@ -384,7 +385,6 @@ class UserInfo extends Component<any, any> {
closeIntegralText = () => { closeIntegralText = () => {
this.setState({ isShowIntegralText: false }); this.setState({ isShowIntegralText: false });
setTimeout(() => { setTimeout(() => {
// this.goUser();
this.onSkip(); this.onSkip();
}, 600); }, 600);
}; };

@ -5,8 +5,8 @@ import { createSlice } from "@reduxjs/toolkit";
const globalStoreReducer = createSlice({ const globalStoreReducer = createSlice({
name: "globalStore", // store的名字 name: "globalStore", // store的名字
initialState: { initialState: {
domain: "https://flossom.yq-h5.cn/prod-api", // 请求地址 domain: "https://flossom.yq-h5.cn/prod-api/hzwx", // 请求地址
// domain: "http://192.168.10.147:8080", // 请求地址 // domain: "http://192.168.10.147:8080/hzwx", // 请求地址
// 是否首次进入首页 // 是否首次进入首页
isShowIndexFlag: false, isShowIndexFlag: false,
}, },

@ -0,0 +1,34 @@
import Taro from "@tarojs/taro";
import { createSlice } from "@reduxjs/toolkit";
// 当前设备:设备介绍页使用
const instrumentReducer = createSlice({
name: "instrument", // store的名字
initialState: {
bindingStatus: 0, // 0已绑定1未绑定2已解绑
createBy: null,
createTime: "",
exportFields: [],
id: 0,
instrumentId: 0,
instrumentIdArray: null,
instrumentName: "",
instrumentSerialIdList: [],
queryInstrumentIds: null,
remark: null,
serial: "", // 设备序列号
source: "",
status: 0, // 0正常 1停用
updateBy: null,
updateTime: null,
validStatus: 1, // 1有效0无效
},
reducers: {
setInstrument(state, { payload }) {
state = JSON.parse(JSON.stringify(payload));
},
},
});
export const { setInstrument } = instrumentReducer.actions;
export default instrumentReducer.reducer;

@ -5,6 +5,7 @@ import navigationReducer from "./features/navigation";
import userInfoReducer from "./features/userInfo"; import userInfoReducer from "./features/userInfo";
import globalStoreReducer from "./features/globalStore"; import globalStoreReducer from "./features/globalStore";
import otherSettingReducer from "./features/otherSetting"; import otherSettingReducer from "./features/otherSetting";
import instrumentReducer from "./features/instrument";
const store = configureStore({ const store = configureStore({
reducer: { reducer: {
@ -14,6 +15,7 @@ const store = configureStore({
userInfo: userInfoReducer, userInfo: userInfoReducer,
globalStore: globalStoreReducer, globalStore: globalStoreReducer,
otherSetting: otherSettingReducer, otherSetting: otherSettingReducer,
instrument: instrumentReducer,
}, },
}); });

@ -11,7 +11,7 @@ export const WCUserLogin = (data) => {
//登录 //登录
return Ajax({ return Ajax({
// url: "/wx/user/login", // url: "/wx/user/login",
url: "/hzwx/user/login?code=" + data.code, url: "/user/login?code=" + data.code,
data, data,
method: "POST", method: "POST",
}); });
@ -19,21 +19,21 @@ export const WCUserLogin = (data) => {
export const MpSplashDetail = (data) => { export const MpSplashDetail = (data) => {
return Ajax({ return Ajax({
// url: "/api/MpSplashDetail", // url: "/api/MpSplashDetail",
url: "/hzwx/firing/list" + paramsToUrlQueryString(data), url: "/firing/list" + paramsToUrlQueryString(data),
method: "get", method: "get",
}); });
}; };
export const getUserAgreement = (data) => { export const getUserAgreement = (data) => {
//用户协议获取 //用户协议获取
return Ajax({ return Ajax({
url: "/hzwx/setting/getUserAgreement", url: "/setting/getUserAgreement",
data, data,
}); });
}; };
export const GetAboutUs = (data) => { export const GetAboutUs = (data) => {
//获取用户信息接口 //获取用户信息接口
return Ajax({ return Ajax({
url: "/hzwx/setting/getAboutUs", url: "/setting/getAboutUs",
data, data,
method: "get", method: "get",
}); });
@ -41,7 +41,7 @@ export const GetAboutUs = (data) => {
export const UpdateUser = (data) => { export const UpdateUser = (data) => {
// 更新用户信息 // 更新用户信息
return AjaxFormData({ return AjaxFormData({
url: "/hzwx/user/updateUser", url: "/user/updateUser",
data, data,
method: "post", method: "post",
}); });
@ -50,7 +50,7 @@ export const UpdateUserUploadFile = (formData) => {
// 更新用户信息且上传头像文件 // 更新用户信息且上传头像文件
return AjaxUploadFile( return AjaxUploadFile(
{ {
url: "/hzwx/user/updateUser", url: "/user/updateUser",
filePath: formData.file, filePath: formData.file,
}, },
formData formData
@ -59,7 +59,7 @@ export const UpdateUserUploadFile = (formData) => {
export const RefreshWxUserInfo = (data) => { export const RefreshWxUserInfo = (data) => {
// 刷新用户信息 // 刷新用户信息
return Ajax({ return Ajax({
url: "/hzwx/user/refreshWxUserInfo", url: "/user/refreshWxUserInfo",
data, data,
method: "get", method: "get",
}); });
@ -67,7 +67,7 @@ export const RefreshWxUserInfo = (data) => {
export const GetProvince = (data) => { export const GetProvince = (data) => {
// 获取全部省份 // 获取全部省份
return Ajax({ return Ajax({
url: "/hzwx/region/getProvince", url: "/region/getProvince",
data, data,
method: "get", method: "get",
}); });
@ -75,7 +75,7 @@ export const GetProvince = (data) => {
export const GetAreaListByPid = (data) => { export const GetAreaListByPid = (data) => {
// 获取全部省份 ?pid=xxx // 获取全部省份 ?pid=xxx
return Ajax({ return Ajax({
url: "/hzwx/region/getAreaListByPid" + paramsToUrlQueryString(data), url: "/region/getAreaListByPid" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -86,7 +86,7 @@ export const GetUserMobile = (data = { code: "" }) => {
} }
//获取用户手机号码 //获取用户手机号码
return Ajax({ return Ajax({
url: "/hzwx/user/upgradeMember" + paramsToUrlQueryString(data), url: "/user/upgradeMember" + paramsToUrlQueryString(data),
data, data,
method: "post", method: "post",
}); });
@ -96,14 +96,14 @@ export const GetUserMobile = (data = { code: "" }) => {
export const getAboutUs = (data) => { export const getAboutUs = (data) => {
//关于我们 //关于我们
return Ajax({ return Ajax({
url: "/hzwx/setting/getAboutUs", url: "/setting/getAboutUs",
data, data,
}); });
}; };
export const getPrivacyAgreement = (data) => { export const getPrivacyAgreement = (data) => {
//用户隐私协议获取 //用户隐私协议获取
return Ajax({ return Ajax({
url: "/hzwx/setting/getPrivacyAgreement", url: "/setting/getPrivacyAgreement",
data, data,
method: "get", method: "get",
}); });
@ -111,7 +111,7 @@ export const getPrivacyAgreement = (data) => {
export const GetOtherSetting = (data) => { export const GetOtherSetting = (data) => {
// 获取其他设置 // 获取其他设置
return Ajax({ return Ajax({
url: "/hzwx/setting/getOtherSetting", url: "/setting/getOtherSetting",
data, data,
method: "get", method: "get",
}); });
@ -119,7 +119,7 @@ export const GetOtherSetting = (data) => {
export const getContactWorker = (data) => { export const getContactWorker = (data) => {
// 联系客服 // 联系客服
return Ajax({ return Ajax({
url: "/hzwx/setting/getContactWorker", url: "/setting/getContactWorker",
data, data,
method: "get", method: "get",
}); });
@ -127,7 +127,7 @@ export const getContactWorker = (data) => {
export const SaveMessage = (data) => { export const SaveMessage = (data) => {
// 联系客服-保存信息 // 联系客服-保存信息
return Ajax({ return Ajax({
url: "/hzwx/api/leaveMessage/saveMessage", url: "/api/leaveMessage/saveMessage",
data, data,
method: "post", method: "post",
}); });
@ -137,7 +137,7 @@ export const SaveMessage = (data) => {
export const GetNoReadMessageNum = (data) => { export const GetNoReadMessageNum = (data) => {
// 查询是否有消息未读 // 查询是否有消息未读
return Ajax({ return Ajax({
url: "/hzwx/userScriptLog/getNoReadMessageNum", url: "/userScriptLog/getNoReadMessageNum",
data, data,
method: "get", method: "get",
}); });
@ -146,7 +146,7 @@ export const GetNoReadMessageNum = (data) => {
export const GetHasBeenRead = (data) => { export const GetHasBeenRead = (data) => {
// 将消息设置为已读 // 将消息设置为已读
return Ajax({ return Ajax({
url: "/hzwx/userScriptLog/hasBeenRead", url: "/userScriptLog/hasBeenRead",
data, data,
method: "get", method: "get",
}); });
@ -155,7 +155,7 @@ export const GetHasBeenRead = (data) => {
export const GetMessageList = (data) => { export const GetMessageList = (data) => {
// 分页获取消息 // 分页获取消息
return Ajax({ return Ajax({
url: "/hzwx/userScriptLog/list" + paramsToUrlQueryString(data), url: "/userScriptLog/list" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -165,7 +165,7 @@ export const GetMessageList = (data) => {
export const GetObtainUserIntegral = (data) => { export const GetObtainUserIntegral = (data) => {
// 分页获取用户积分列表 // 分页获取用户积分列表
return Ajax({ return Ajax({
url: "/hzwx/integralLog/obtainUserIntegral" + paramsToUrlQueryString(data), url: "/integralLog/obtainUserIntegral" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -173,7 +173,7 @@ export const GetObtainUserIntegral = (data) => {
export const GetIntegralRule = (data) => { export const GetIntegralRule = (data) => {
// 获取积分规则 // 获取积分规则
return Ajax({ return Ajax({
url: "/hzwx/setting/getIntegralRule", url: "/setting/getIntegralRule",
data, data,
method: "get", method: "get",
}); });
@ -181,7 +181,7 @@ export const GetIntegralRule = (data) => {
export const GetIsAttentionOfficialAccount = (data) => { export const GetIsAttentionOfficialAccount = (data) => {
// 查询用户是否关注公众号 // 查询用户是否关注公众号
return Ajax({ return Ajax({
url: "/hzwx/noRemind/isAttentionOfficialAccount", url: "/noRemind/isAttentionOfficialAccount",
data, data,
method: "get", method: "get",
}); });
@ -189,7 +189,7 @@ export const GetIsAttentionOfficialAccount = (data) => {
export const GetOfficialAccount = (data) => { export const GetOfficialAccount = (data) => {
// 查询用户是否关闭提醒关注公众号 // 查询用户是否关闭提醒关注公众号
return Ajax({ return Ajax({
url: "/hzwx/noRemind/getOfficialAccount", url: "/noRemind/getOfficialAccount",
data, data,
method: "get", method: "get",
}); });
@ -197,7 +197,7 @@ export const GetOfficialAccount = (data) => {
export const GetCloseOfficialAccount = (data) => { export const GetCloseOfficialAccount = (data) => {
// 查询关闭提醒关注公众号 // 查询关闭提醒关注公众号
return Ajax({ return Ajax({
url: "/hzwx/noRemind/closeOfficialAccount", url: "/noRemind/closeOfficialAccount",
data, data,
method: "get", method: "get",
}); });
@ -206,7 +206,7 @@ export const GetCloseOfficialAccount = (data) => {
export const GetSitePopupList = (data) => { export const GetSitePopupList = (data) => {
// 站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块 // 站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
return Ajax({ return Ajax({
url: "/hzwx/siteInfo/popup/" + data, url: "/siteInfo/popup/" + data,
data, data,
method: "get", method: "get",
}); });
@ -214,7 +214,7 @@ export const GetSitePopupList = (data) => {
export const GetSiteCarousel = (data) => { export const GetSiteCarousel = (data) => {
// 站点管理-轮播图 // 站点管理-轮播图
return Ajax({ return Ajax({
url: "/hzwx/siteInfo/carousel", url: "/siteInfo/carousel",
data, data,
method: "get", method: "get",
}); });
@ -222,7 +222,7 @@ export const GetSiteCarousel = (data) => {
export const GetSiteAddTag = (data) => { export const GetSiteAddTag = (data) => {
// 站点管理-轮播图-添加标签 传值是id // 站点管理-轮播图-添加标签 传值是id
return Ajax({ return Ajax({
url: "/hzwx/siteInfo/addTag/" + data, url: "/siteInfo/addTag/" + data,
data, data,
method: "get", method: "get",
}); });
@ -235,16 +235,24 @@ export const InstrumentInfo = {
// 根据序列号获取仪器信息 // 根据序列号获取仪器信息
return Ajax({ return Ajax({
url: url:
"/hzwx/instrument/getInstrumentInfoBySerial" + "/instrument/getInstrumentInfoBySerial" + paramsToUrlQueryString(data),
paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
}, },
isBindingSerial: (data) => {
// 根据序列号获取仪器信息
return Ajax({
url: "/instrument/isBindingSerial" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
binding: (data) => { binding: (data) => {
// 绑定仪器 // 绑定仪器
return Ajax({ return Ajax({
url: "/hzwx/instrument/binding" + paramsToUrlQueryString(data), url: "/instrument/binding" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -252,7 +260,7 @@ export const InstrumentInfo = {
exchangeBinding: (data) => { exchangeBinding: (data) => {
// 更换绑定仪器 // 更换绑定仪器
return Ajax({ return Ajax({
url: "/hzwx/instrument/exchangeBinding" + paramsToUrlQueryString(data), url: "/instrument/exchangeBinding" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -260,21 +268,21 @@ export const InstrumentInfo = {
bindingInstrumentList: () => { bindingInstrumentList: () => {
// 获取当前用户:已绑定仪器列表 // 获取当前用户:已绑定仪器列表
return Ajax({ return Ajax({
url: "/hzwx/instrument/bindingInstrumentList", url: "/instrument/bindingInstrumentList",
method: "get", method: "get",
}); });
}, },
unbindingInstrumentInfoList: () => { unbindingInstrumentInfoList: () => {
// 获取当前用户:未绑定仪器列表 // 获取当前用户:未绑定仪器列表
return Ajax({ return Ajax({
url: "/hzwx/instrument/unbindingInstrumentInfoList", url: "/instrument/unbindingInstrumentInfoList",
method: "get", method: "get",
}); });
}, },
manualCodeBinding: (data) => { manualCodeBinding: (data) => {
// 用户手动绑定仪器 // 用户手动绑定仪器
return Ajax({ return Ajax({
url: "/hzwx/instrument/manualCodeBinding", url: "/instrument/manualCodeBinding",
data, data,
method: "post", method: "post",
}); });
@ -290,7 +298,7 @@ export const InstrumentInfo = {
firstNurseInfo: (data) => { firstNurseInfo: (data) => {
// 根据仪器ID获取仪器的初次护理信息 // 根据仪器ID获取仪器的初次护理信息
return Ajax({ return Ajax({
url: "/hzwx/instrument/firstNurseInfo" + paramsToUrlQueryString(data), url: "/instrument/firstNurseInfo" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });
@ -298,7 +306,7 @@ export const InstrumentInfo = {
modeInfo: (data) => { modeInfo: (data) => {
// 根据仪器ID获取仪器模式 // 根据仪器ID获取仪器模式
return Ajax({ return Ajax({
url: "/hzwx/instrument/modeInfo" + paramsToUrlQueryString(data), url: "/instrument/modeInfo" + paramsToUrlQueryString(data),
data, data,
method: "get", method: "get",
}); });

@ -42,14 +42,15 @@ export const Ajax = (params) => {
}, },
data: params.data, data: params.data,
success(res) { success(res) {
if (res.statusCode !== 200) { // console.log("res", res);
if (res.statusCode == 401 || res.data.code == 403) { if (res.data.code == 401 || res.data.code == 403) {
// 自动重新登录 // 自动重新登录
setStorageSync("token", null); Taro.removeStorageSync("token");
loginReload(params); loginReload(params);
return; return;
} }
if (res.statusCode !== 200) {
Taro.showModal({ Taro.showModal({
title: "提示", title: "提示",
content: String("错误码:" + res.statusCode), content: String("错误码:" + res.statusCode),
@ -57,11 +58,8 @@ export const Ajax = (params) => {
}); });
return false; return false;
} }
if (params.url == "/Api/ReadFileInstrument") {
reslove(res); if (res.data.code === 500) {
return false;
}
if (res.data.code !== 200) {
let msg = let msg =
typeof res.data.msg == "string" typeof res.data.msg == "string"
? res.data.msg ? res.data.msg
@ -90,7 +88,7 @@ export const Ajax = (params) => {
// }); // });
}, },
complete() { complete() {
// Taro.hideLoading(); Taro.hideLoading();
// const requestUrlList = global_requestUrlList; // const requestUrlList = global_requestUrlList;
// const newRequestUrlList = requestUrlList.splice( // const newRequestUrlList = requestUrlList.splice(
// requestUrlList.indexOf(params.url), // requestUrlList.indexOf(params.url),
@ -185,13 +183,14 @@ export const AjaxFormData = (params) => {
}, },
data: params.data.buffer, data: params.data.buffer,
success(res) { success(res) {
if (res.data.code == 401 || res.data.code == 403) {
// 自动重新登录
Taro.removeStorageSync("token");
loginReload(params);
return;
}
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
if (res.statusCode == 401 || res.data.code == 403) {
// 自动重新登录
setStorageSync("token", null);
loginReload(params);
return;
}
Taro.showModal({ Taro.showModal({
t2: String("错误码:" + res.statusCode), t2: String("错误码:" + res.statusCode),
showCancel: false, showCancel: false,
@ -221,7 +220,7 @@ export const AjaxFormData = (params) => {
res.data.msg === "登录状态已过期" res.data.msg === "登录状态已过期"
) { ) {
// 自动重新登录 // 自动重新登录
setStorageSync("token", null); Taro.removeStorageSync("token");
loginReload(params); loginReload(params);
return; return;
} }
@ -281,7 +280,7 @@ const loginReload = async (_params) => {
const { code } = await Taro.login(); const { code } = await Taro.login();
const { data } = await Ajax({ const { data } = await Ajax({
// url: "/wx/user/login", // url: "/wx/user/login",
url: "/hzwx/user/login?code=" + code, url: "/user/login?code=" + code,
data: { code: code }, data: { code: code },
method: "POST", method: "POST",
}); });
@ -298,7 +297,7 @@ const loginReload = async (_params) => {
content: "登录已过期,请重新登录", content: "登录已过期,请重新登录",
showCancel: false, showCancel: false,
}).then((res) => { }).then((res) => {
setStorageSync("token", null); Taro.removeStorageSync("token");
Taro.clearStorage(); // 清空所有缓存 Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({ Taro.reLaunch({
url: "/pages/initiate/initiate", url: "/pages/initiate/initiate",

Loading…
Cancel
Save