绑定流程临时提交

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

@ -17,7 +17,7 @@ Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN
2. 下载项目依赖
```javascript
npm i -f // 强制下载安装依赖
npm i -f // 强制下载安装依赖 注意请使用npm源taobao源可能下载失败
```
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-redux": "^9.0.3",
"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": {
"@babel/core": "^7.8.0",

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

@ -70,6 +70,7 @@ export default class PopupBinding extends Component<any, any> {
let {
title,
data,
isExchangeBinding,
content,
cancelButtonText,
confirmButtonText,
@ -80,8 +81,19 @@ export default class PopupBinding extends Component<any, any> {
type,
} = this.props;
let serial = Taro.getStorageSync("serial");
let isSerial = String(serial) === String(data.serial) ? true : false;
// let serial = Taro.getStorageSync("serial");
// 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 (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
@ -107,7 +119,9 @@ export default class PopupBinding extends Component<any, any> {
></PopupAlert>
)}
{isRegisterBoolean && (type === 1 || type === 2) && (
{isRegisterBoolean &&
(type === 1 || type === 2) &&
!isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}
@ -117,7 +131,9 @@ export default class PopupBinding extends Component<any, any> {
<View className={classnames("text-center")}>
<View>{data.instrumentName}</View>
<View style="margin-top:20rpx">{data.serial}</View>
<View style="margin-top:20rpx"></View>
<View style="margin-top:20rpx">
</View>
</View>
</Block>
}
@ -127,7 +143,9 @@ export default class PopupBinding extends Component<any, any> {
confirm={this.onConfirm}
></PopupConfirm>
)}
{isRegisterBoolean && type === 2 && (
{isRegisterBoolean &&
(type === 1 || type === 2) &&
isExchangeBinding && (
<PopupConfirm
isShow={isShow}
isClose={false}

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

@ -349,7 +349,7 @@ export default class Instrument extends Component<any, any> {
} = this.state;
return (
<Block>
<PopupAlert
{/* <PopupAlert
isShow={true}
isClose={true}
title="提示"
@ -358,7 +358,7 @@ export default class Instrument extends Component<any, any> {
textAlgin="center"
close={this.closeDev}
confirm={this.closeDev}
/>
/> */}
<Navbar titleSlot="仪器绑定" isBack={true} />
<PopupAlert
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 = () => {
const isScan = Taro.getStorageSync("isScan");
if (isScan) {
Taro.setStorageSync("isScanNotRegisterSkip", true);
}
Taro.reLaunch({
url: "/pages/index/index",
});

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

@ -5,8 +5,8 @@ import { createSlice } from "@reduxjs/toolkit";
const globalStoreReducer = createSlice({
name: "globalStore", // store的名字
initialState: {
domain: "https://flossom.yq-h5.cn/prod-api", // 请求地址
// domain: "http://192.168.10.147:8080", // 请求地址
domain: "https://flossom.yq-h5.cn/prod-api/hzwx", // 请求地址
// domain: "http://192.168.10.147:8080/hzwx", // 请求地址
// 是否首次进入首页
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 globalStoreReducer from "./features/globalStore";
import otherSettingReducer from "./features/otherSetting";
import instrumentReducer from "./features/instrument";
const store = configureStore({
reducer: {
@ -14,6 +15,7 @@ const store = configureStore({
userInfo: userInfoReducer,
globalStore: globalStoreReducer,
otherSetting: otherSettingReducer,
instrument: instrumentReducer,
},
});

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

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

Loading…
Cancel
Save