master
rongweikang 3 years ago
commit 50da63ce9f

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

60714
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,10 @@ export default defineAppConfig({
'pages/userInfoDetail/userInfoDetail',
"pages/register/register",
'pages/instrument/instrument',
"pages/instrument/intro",
"pages/instrument_manage/index",
"pages/instrument_detail/index",
"pages/instrument_clickin_upload/index",
'pages/privacyPolicy/privacyPolicy',
'pages/userPolicy/userPolicy',
'pages/about/about',

@ -24,16 +24,9 @@ class App extends Component<PropsWithChildren> {
return;
}
// go("/pages/instrument_clickin_upload/index");
// go("/pages/instrument/intro");
// Taro.switchTab({
// url: "pages/index/index",
// });
// go("/pages/initiate/initiate"); // 介绍页
// go("/pages/entry/entry"); // 介绍页
// go("/pages/userInfo/userInfo"); // 个人信息完善
// go("/pages/register/register");
// go("/pages/instrument/instrument");
// go("/pages/userInfoDetail/userInfoDetail");
// Taro.reLaunch({
// url: "/pages/user/user",
// });
}

@ -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,49 +119,55 @@ export default class PopupBinding extends Component<any, any> {
></PopupAlert>
)}
{isRegisterBoolean && (type === 1 || 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>
</Block>
}
confirmButtonText="确认"
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>
{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>
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不换绑"
close={this.onClose}
confirm={this.onConfirm}
></PopupConfirm>
)}
</Block>
}
confirmButtonText="确认"
cancelButtonText="暂不绑定"
close={this.onClose}
confirm={this.onConfirm}
></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>
);
}

@ -133,7 +133,7 @@ export default class PopupSiteSwiper extends Component<any, any> {
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={true}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
>

@ -1,7 +1,7 @@
import classnames from "classnames";
import { Component } from "react";
import Taro from "@tarojs/taro";
import {Block, Image, Swiper, SwiperItem, View,} from "@tarojs/components";
import { Block, Image, Swiper, SwiperItem, View } from "@tarojs/components";
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh } from "@/store/features/userInfo";
@ -75,7 +75,7 @@ class Entry extends Component<any, any> {
let detail = JSON.parse(MpSplashDetail_type1);
let list = detail.filter((item: any) => item.fileSuffix === "images");
if (list.length === 0) {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
return;
@ -89,7 +89,7 @@ class Entry extends Component<any, any> {
});
this.setState({ welcomeList });
} else {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
}
@ -121,7 +121,7 @@ class Entry extends Component<any, any> {
// Taro.switchTab({
// url: "/pages/index/index",
// });
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
}
@ -198,8 +198,6 @@ class Entry extends Component<any, any> {
>
{item.desc}
</View>
</View>
</View>
</View>

@ -42,7 +42,13 @@ 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,
setStorageSync,
} from "@/utils/traoAPI";
class Index extends Component<any, any> {
// pageCtx = Taro.getCurrentInstance().page;
@ -88,10 +94,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 +112,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 +208,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 +258,6 @@ class Index extends Component<any, any> {
isShowSiteSwiper: true,
});
}
} else {
// msg("暂无数据");
}
}
};
@ -366,13 +372,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 +412,20 @@ class Index extends Component<any, any> {
}
}
closeBinding = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
this.setState({ isVisibleBinding: false });
};
confirmBinding = () => {
// let { instrumentInfo } = this.state;
this.bindingInstrument();
let { isExchangeBinding } = this.state;
if (!isExchangeBinding) {
// 绑定仪器
this.bindingInstrument();
} else {
// 换绑仪器
this.exchangeBinding();
}
};
// 根据扫码的序列号获取仪器信息
getInstrumentInfoBySerial = async () => {
@ -423,33 +437,56 @@ 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,10 +497,20 @@ 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.setState({ isExchangeBinding: true, isVisibleBinding: true });
} else if (data.code === 201) {
// 跳转联系客服
this.setState({ isBindingError: true });
} else {
this.setState({ isBindingError: true });
}
@ -480,21 +527,39 @@ class Index extends Component<any, any> {
});
console.log("exchangeBinding", data);
Taro.hideLoading();
this.closeBinding();
if (data.code === 200) {
this.setState({ isVisibleBinding: false });
} else {
this.closeBinding();
this.setState({ isBindingError: true });
}
};
// 仪器绑定失败弹窗
onBindErrorClose = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
this.setState({ isBindingError: false });
};
onBindErrorConfirm = () => {
this.onBindErrorClose();
go("/pages/consultant/consultant");
};
// InstrumentInfo
onBeforeBindClose = () => {
Taro.removeStorageSync("isScan"); // 扫码弹窗显示完后,不需要再判断是否扫码
Taro.removeStorageSync("serial"); // 扫码弹窗显示完后,删除缓存的扫码序列号
this.setState({ isBeforeBinding: false });
};
onBeforeBindConfirm = () => {
this.setState({ isBeforeBinding: false });
};
// 跳转仪器介绍页
goNursing = (item) => {
console.log("goNursing", item);
setStorageSync("instrument_item", JSON.stringify(item));
go("/pages/instrument_clickin_upload/index?id=" + item.id);
// go("/pages/instrument/intro?id=" + item.id);
};
/* 扫码进入逻辑 */
render() {
@ -514,9 +579,12 @@ class Index extends Component<any, any> {
// 绑定弹窗
isVisibleBinding,
isBindingError,
isBeforeBinding,
isRegisterBoolean,
isExchangeBinding,
typeBinding,
instrumentInfo,
instrumentList,
} = this.state;
return (
@ -550,6 +618,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 +626,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,33 +702,70 @@ class Index extends Component<any, any> {
</View>
</View>
<View className="infobox5">
<View
className={classnames("nurse_plan_box", "flex", "aitems", "sb")}
>
<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">
{instrumentList.length > 0 && (
<Block>
<View className="nurse_plan_box flex aitems sb">
<View className="title"></View>
<View
className="at-icon at-icon-add"
style="color: #fff;font-size: 30rpx;"
></View>
<View className="txt" onClick={this.addNewDevice}>
className="txt_box flex jcenter aitems"
data-url="/pages/instrument/instrument"
onClick={this.gourl}
>
<Image
className="right_icon"
src={require("../../img/black-add.png")}
mode="aspectFill"
/>
<View className="txt"></View>
</View>
</View>
</View>
<View className="tips"></View>
</View>
<View style="overflow-x: auto;">
<View className="device_list flex">
{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 className="infobox3">

@ -94,13 +94,13 @@ class Initiate extends Component<any, any> {
return;
} else {
// 1-3.如果介绍页图片也没有,直接跳转首页
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
}
}
} else {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
}
@ -151,7 +151,7 @@ class Initiate extends Component<any, any> {
let detail = JSON.parse(data);
let list = detail.filter((item: any) => item.fileSuffix === "images");
if (list.length === 0) {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
return;

@ -22,7 +22,7 @@ page {
.footer {
position: fixed;
z-index: 1;
z-index: 10;
bottom: 0;
display: flex;
justify-content: center;
@ -75,7 +75,8 @@ page {
height: 460rpx;
border-radius: 30rpx;
// margin: 43rpx 35rpx 51rpx;
margin: 43rpx 35rpx 67rpx;
// margin: 43rpx 35rpx 67rpx;
margin: 43rpx 35rpx 89rpx;
background-color: #ababab;
}

@ -17,16 +17,14 @@ import {
Canvas,
} from "@tarojs/components";
import { InstrumentInfo } from "../../utils/Interface";
import { go, back, loading, msg, showModal } from "../../utils/traoAPI";
import { isVideo } from "../../utils/util";
import utilHtml from "../../utils/utilhtml";
import { InstrumentInfo } from "@/utils/Interface";
import { go, back, msg, setStorageSync, getStorageSync } from "@/utils/traoAPI";
import { getImgInfo, contraction } from "../../utils/compressImage";
import { getImgInfo, contraction } from "@/utils/compressImage";
/* 自定义组件 */
import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import Navbar from "@/components/navbar/navbar";
import PopupAlert from "@/components/popup/popup-alert";
/* 组件 */
import "./instrument.less";
@ -45,9 +43,8 @@ export default class Instrument extends Component<any, any> {
channelList: [],
channelInfo: {
id: "",
image: "",
serial: "",
bind_intro_Video: "",
serialImage: "",
serialCode: "",
},
equipmentList: [
{
@ -83,22 +80,22 @@ export default class Instrument extends Component<any, any> {
onSerial = (event) => {
const { value } = event.detail;
let { channelInfo } = this.state;
channelInfo.serial = value;
channelInfo.serialCode = value;
this.setState({ channelInfo });
};
onScanCode() {
Taro.scanCode({
scanType: ["qrCode"],
success: (res) => {
let { channelInfo } = this.state;
channelInfo.serial = res.result;
// onScanCode() {
// Taro.scanCode({
// scanType: ["qrCode"],
// success: (res) => {
// let { channelInfo } = this.state;
// channelInfo.serialCode = res.result;
this.setState({ channelInfo });
},
});
}
// this.setState({ channelInfo });
// },
// });
// }
onTipShow = () => {
this.setState({ tipShow: true });
@ -127,13 +124,16 @@ export default class Instrument extends Component<any, any> {
if (result.indexOf("?") > -1) {
const bindCode = result.split("?")[1];
console.log("bindCode", bindCode);
const { channelInfo } = this.state;
channelInfo.serialCode = bindCode;
this.setState({
bindCode,
channelInfo,
});
}
this.bindingInstrument();
// this.getBindCodeInfo();
setTimeout(() => {
this.scanCodeBinding();
}, 10);
},
fail(err) {},
complete(res) {},
@ -238,6 +238,9 @@ export default class Instrument extends Component<any, any> {
Taro.chooseMedia({
count: 1,
mediaType: ["image"],
sourceType: ["album", "camera"],
sizeType: ["compressed"],
camera: "back",
success: async (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
let img = await getImgInfo(tempFilePath);
@ -245,39 +248,26 @@ export default class Instrument extends Component<any, any> {
// 压缩后文件地址
let compressTempFilePath = compressImage.tempFilePath;
let { channelInfo } = this.state;
channelInfo.image = compressTempFilePath;
channelInfo.serialImage = compressTempFilePath;
this.setState({ channelInfo });
},
});
};
onSubmit = () => {
const that = this;
const { serial, image, buy_id, id } = this.state.channelInfo;
const { serial, serialImage, id } = this.state.channelInfo;
if (!serial?.trim()) return msg("请输入设备序列号");
if (!image) return msg("请上传序列号照片");
// if (!buy_id) return msg('请选择购买渠道');
// loading("绑定中");
// InstrumentBindingAdd({ serial, image, buy_id, instrument_id: id })
// .then((res) => {
// this.setState({ succeedShow: true });
// })
// .catch((err) => {
// if (err.data.code != 400) {
// that.setState({
// errorMsg: err.data.msg,
// bindPopup: "errorMsg",
// });
// }
// });
if (!serialImage) return msg("请上传序列号照片");
this.manualCodeBinding();
};
onSelectChange(item) {
const { channelInfo } = this.state;
if (channelInfo.id === item.id) return;
channelInfo.serialCode = "";
this.setState({
channelInfo: item,
isVideo: isVideo(item.bind_intro_video),
isVideo: this.isVideo(item.banner),
});
}
@ -289,38 +279,97 @@ export default class Instrument extends Component<any, any> {
// go("/pages/user/user");
let isInstrumentJump = Taro.getStorageSync("isInstrumentJump");
if (isInstrumentJump === "true") {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/user/user",
});
}
};
isVideo = (str) => {
if (str.includes(".mp4")) {
return true;
}
return false;
};
// 未绑定列表
unbindingInstrumentInfoList = async () => {
let { data } = await InstrumentInfo.unbindingInstrumentInfoList();
if (data.code === 200) {
console.log("data", data);
if (data.data.length) {
this.setState({ equipmentList: data.data, channelInfo: data.data[0] });
let item = data.data[0];
item.serialCode = "";
this.setState({
equipmentList: data.data,
channelInfo: item,
isVideo: this.isVideo(item.banner),
});
}
}
};
// 绑定仪器
bindingInstrument = async () => {
manualCodeBinding = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { channelInfo } = this.state;
let res = await InstrumentInfo.manualCodeBinding({
serial: channelInfo.serialCode,
serialImage: channelInfo.serialImage,
instrumentId: channelInfo.id,
});
console.log("bindingInstrument", res);
Taro.hideLoading();
if (res.code === 200) {
this.binding();
} else if (res.code === 204) {
this.setState({ isBindingCheckError: false });
} else {
this.setState({ isBindingError: true });
}
};
scanCodeBinding = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { instrumentInfo } = this.state;
let { data } = await InstrumentInfo.binding({
serial: instrumentInfo.serial,
let { channelInfo } = this.state;
let res = await InstrumentInfo.scanCodeBinding({
serial: channelInfo.serialCode,
instrumentId: channelInfo.id,
});
console.log("bindingInstrument", data);
Taro.hideLoading();
if (data.code === 200) {
if (res.data.code === 200) {
// this.setState({ isVisibleBinding: false });
this.binding();
} else if (res.data.code === 204) {
this.setState({ isBindingCheckError: false });
} else {
this.setState({ isBindingError: true });
}
};
binding = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { channelInfo } = this.state;
let res = await InstrumentInfo.binding({
serial: channelInfo.serialCode,
});
Taro.hideLoading();
if (res.data.code === 200) {
// this.setState({ isVisibleBinding: false });
msg("绑定成功");
setStorageSync("instrument_item", JSON.stringify(channelInfo));
go("/pages/instrument/intro?id=" + channelInfo.id);
} else if (res.data.code === 204) {
this.setState({ isBindingCheckError: false });
} else {
this.setState({ isBindingError: true });
}
@ -341,7 +390,6 @@ export default class Instrument extends Component<any, any> {
let {
isBindingError,
isBindingCheckError,
isVideo,
channelInfo,
inputType,
style,
@ -349,7 +397,7 @@ export default class Instrument extends Component<any, any> {
} = this.state;
return (
<Block>
<PopupAlert
{/* <PopupAlert
isShow={true}
isClose={true}
title="提示"
@ -358,7 +406,7 @@ export default class Instrument extends Component<any, any> {
textAlgin="center"
close={this.closeDev}
confirm={this.closeDev}
/>
/> */}
<Navbar titleSlot="仪器绑定" isBack={true} />
<PopupAlert
isShow={isBindingError}
@ -397,7 +445,7 @@ export default class Instrument extends Component<any, any> {
<View className="top_tips"></View>
</View>
<View className="banner_list">
{isVideo && channelInfo.bind_intro_Video ? (
{inputType === 1 ? (
<Video
className="banner_item"
autoplay
@ -405,12 +453,12 @@ export default class Instrument extends Component<any, any> {
enablePlayGesture
showFullscreenBtn={false}
playBtnPosition="center"
src={utilHtml.getHttpsUrl(channelInfo.bind_intro_Video)}
src={channelInfo.manualCodeBinding}
/>
) : (
<Image
className="banner_item"
src={utilHtml.getHttpsUrl(channelInfo.bind_intro_Video)}
src={channelInfo.scanCodeBinding}
mode="aspectFill"
></Image>
)}
@ -423,6 +471,9 @@ export default class Instrument extends Component<any, any> {
style="font-size: 32rpx; margin: 0 0 0rpx 2rpx"
>
<Text style={{ color: "#EB5858", marginLeft: "20rpx" }}>
*
</Text>
</View>
</View>
@ -444,7 +495,7 @@ export default class Instrument extends Component<any, any> {
>
<Image
className="instrument_img"
src={utilHtml.getHttpsUrl(item.banner)}
src={item.banner}
mode="aspectFill"
// mode="aspectFit"
></Image>
@ -465,15 +516,17 @@ export default class Instrument extends Component<any, any> {
<Text></Text>
<View className="tab_active_line"></View>
</View>
<View
className={classnames("tab_item", {
"is-active": inputType === 2,
})}
onClick={this.onTabTap.bind(this, 2)}
>
<Text></Text>
<View className="tab_active_line"></View>
</View>
{channelInfo.isScanCode === 1 && (
<View
className={classnames("tab_item", {
"is-active": inputType === 2,
})}
onClick={this.onTabTap.bind(this, 2)}
>
<Text></Text>
<View className="tab_active_line"></View>
</View>
)}
</View>
</View>
@ -482,7 +535,12 @@ export default class Instrument extends Component<any, any> {
<View className="inputCode_box">
<View className="form_item is-inputCode">
<View className="label_box">
<View className="label"></View>
<View className="label">
<Text style={{ color: "#EB5858", marginLeft: "20rpx" }}>
*
</Text>
</View>
<View className="label_text" onClick={this.onTipShow}>
<Text className="label-tips"></Text>
<Image
@ -499,22 +557,27 @@ export default class Instrument extends Component<any, any> {
placeholder="例如FR10*********1"
placeholder-style={style}
onInput={this.onSerial}
value={channelInfo.serial}
value={channelInfo.serialCode}
></Input>
</View>
</View>
<View className="form_item">
<View className="label_box">
<View className="label"></View>
<View className="label">
<Text style={{ color: "#EB5858", marginLeft: "20rpx" }}>
*
</Text>
</View>
</View>
<View className="photo_box" onClick={this.onChangeImg}>
{channelInfo.image && (
{channelInfo.serialImage && (
<Image
src={channelInfo.image}
src={channelInfo.serialImage}
mode="aspectFill"
></Image>
)}
{!channelInfo.image && (
{!channelInfo.serialImage && (
<Image
className="add"
src={require("../../img/welcome/add.png")}

@ -0,0 +1,109 @@
.footer {
position: fixed;
bottom: 0;
background: #fff;
flex-direction: column;
width: 100%;
padding-bottom: 30rpx;
// padding-bottom: env(safe-area-inset-bottom);
}
.footer .btn {
width: 690rpx;
height: 90rpx;
background: #000;
border-radius: 45rpx;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #ffffff;
}
.footer .text {
background: transparent;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
.main {
height: 100vh;
text-align: center;
margin-top: 34rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 180rpx);
}
.cover {
display: block; // 消除默认间距
width: 660rpx;
height: 922rpx;
border-radius: 50rpx;
}
.content {
display: block; // 消除默认间距
width: 660rpx;
// height: 474rpx;
height: 488rpx;
background: linear-gradient(rgba(204, 204, 204, 0.4), #fff);
border-radius: 50rpx;
margin-top: 7rpx;
}
.title {
font-size: 48rpx;
font-family: PingFang SC;
font-weight: 500;
color: #000;
text-align: center;
padding-bottom: 30rpx;
padding-top: 84rpx;
}
.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;
// }
.indicator {
position: absolute;
left: 50%;
top: 960rpx;
transform: translate(-50%, -50%);
display: inline-flex;
width: 360rpx;
height: 1px;
background: transparent;
.dot {
display: inline-flex;
flex: 1;
height: 100%;
background: #f2f2f2;
transition-duration: 0.5s;
margin-right: 4rpx;
transition: all 0.6s ease-in-out 0.1s;
}
.bg-show {
background: #000;
}
}

@ -0,0 +1,177 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import {
Block,
View,
Image,
Video,
Swiper,
SwiperItem,
} from "@tarojs/components";
/* 自定义组件 */
import Navbar from "../../components/navbar/navbar";
// import PopupAlert from "../../components/popup/popup-alert";
/* 组件 */
/*** redux ***/
import { connect } from "react-redux";
import { setInstrument } from "../../store/features/instrument";
/*** redux end ***/
import { InstrumentInfo } from "../../utils/Interface";
import { setStorageSync, getStorageSync, go } from "../../utils/traoAPI";
import "./intro.less";
class Intro extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "template模板页",
current: 0,
instrument: {},
introList: [],
isNursing: false,
};
}
async onLoad() {}
componentDidMount() {}
componentWillMount() {
// let params = Taro.Current?.router?.params;
// if (params) {
// this.getInstrumentInfo(params.id);
// }
let strObj = getStorageSync("instrument_item");
if (strObj) {
let instrument = JSON.parse(strObj);
this.getInstrumentInfo(instrument.id);
this.setState({ instrument });
}
}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
onChange(event) {
console.info("onchange", event);
// const current = event.detail.current;
// this.setState({ current });
}
// 获取设备信息
async getInstrumentInfo(id) {
let res = await InstrumentInfo.instructionInfo({
instrumentId: id,
});
if (res.data.code === 200) {
this.setState({ introList: res.data.data });
}
}
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) {
// setStorageSync("introduceId", info.id);
// }
const url = "/pages/index/index";
Taro.switchTab({
url,
});
}
render() {
let { current, introList, instrument } = this.state;
return (
<Block>
<Navbar titleSlot="仪器绑定" isBack={true} />
<View style="position: relative">
<Swiper
className="main"
current={current}
onChange={this.onChange}
duration={800}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
previousMargin="32rpx"
nextMargin="32rpx"
>
{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">{instrument.name}</View>
<View className="text">{item.message}</View>
</View>
</SwiperItem>
);
})}
</Swiper>
{introList.length && (
<View className="indicator">
{introList.map((_item, index) => {
return (
<View
key={"indicator_" + index}
className={classnames("dot", {
"bg-show": current === index,
})}
/>
);
})}
</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>
);
}
}
const mapStateToProps = (state) => ({
instrument: state.instrument,
});
const mapDispatchToProps = (dispatch) => ({
setInstrument(data) {
dispatch(setInstrument(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Intro);

@ -0,0 +1,397 @@
page {
background: #f8f8f8;
}
.titlemain {
position: fixed;
z-index: 99;
width: 100%;
top: 0;
/* box-shadow: 0px 1.5px 6px rgba(0, 0, 0, 0.16) */
}
.titlemain .logoicon {
width: 223rpx;
}
.titlemain .title {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.infobox1 {
/* background: #fff; */
margin: 20rpx 0rpx;
box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05);
#myVideo {
display: block;
margin: 0;
padding: 0;
}
}
.infobox1 .img {
position: relative;
width: calc(345rpx * 2);
height: calc(345rpx * 2);
overflow: hidden;
border-radius: 30rpx;
/* padding: 10rpx; */
/* box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.05); */
margin: auto;
}
.video-cover {
position: absolute;
top: 300rpx;
left: 0;
width: 100%;
height: 160rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border-radius: 30rpx;
}
.video-cover-icon {
width: 90rpx;
height: 90rpx;
}
.video-cover-time {
margin-top: 26rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
}
.infobox2 {
background: #fff;
overflow: hidden;
margin: 20rpx 0 0;
box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05);
}
.infobox2 .info4 {
/* margin: 0 30rpx; */
padding: 41rpx 32rpx 0 32rpx;
}
.infobox2 .info4 .imgbox {
position: relative;
}
.infobox2 .info4 .upload_header .upload_title {
font-size: 36rpx;
font-weight: bold;
color: #030000;
}
.infobox2 .info4 .upload_header .icon {
width: 36rpx;
height: 36rpx;
}
.infobox2 .info4 .imgbox .img {
width: 180rpx;
height: 180rpx;
/* background: #DCB585; */
border-radius: 20rpx;
margin: 43rpx 32rpx 0 0;
position: relative;
overflow: hidden;
}
.infobox2 .info4 .imgbox .img .close {
position: absolute;
background: rgba(27, 7, 7, 0.5);
width: 46rpx;
height: 42rpx;
border-radius: 0 20rpx 0 20rpx;
right: 0;
top: 0;
}
.infobox2 .info4 .imgbox .img .close image {
width: 20rpx;
}
.infobox2 .info4 .imgbox .img2 {
margin: 43rpx 32rpx 0 0;
width: 180rpx;
height: 180rpx;
background: #fff;
border-radius: 20rpx;
border: 2rpx solid #dddddd;
}
.infobox2 .info4 .imgbox .img2 image {
width: 40rpx;
height: 40rpx;
}
.infobox2 .info4 .content {
background: #fff;
border-radius: 3rpx;
padding: 28rpx;
width: calc(100% - 28rpx - 28rpx);
height: 186rpx;
margin: 37rpx 0 20rpx;
/*box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.1);*/
border: 2rpx solid #dddddd;
position: relative;
}
.infobox2 .info4 .content .textarea {
width: 100%;
height: 100%;
color: #000;
font-size: 28rpx;
}
.infobox2 .info4 .content .contenttip {
color: #e1e1e1;
font-size: 20rpx;
position: absolute;
right: 24rpx;
bottom: 18rpx;
}
.infobox2 .info4 .content textarea {
width: 100%;
height: 100%;
font-size: 28rpx;
color: #000;
border-radius: 3rpx;
}
.placeholder {
font-size: 28rpx;
}
.confirm_btn {
position: fixed;
z-index: 999;
bottom: 0;
left: 0;
width: 100%;
height: 153rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
padding: 0 30rpx 21rpx;
box-sizing: border-box;
}
.confirm_btn .btn {
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
background: #000000;
border-radius: 45rpx;
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
}
.infobox3 {
display: block;
margin: 20rpx 31rpx;
height: 162rpx;
font-family: PingFang SC;
.info1 {
display: inline-block;
white-space: nowrap;
background: #fff;
flex-direction: column;
height: 100%;
border-radius: 20rpx;
overflow: hidden;
box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05);
margin-right: 23rpx;
}
.info2 {
width: calc(100% - 130rpx - 20rpx);
background: #fff;
height: 162rpx;
border-radius: 20rpx;
box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05);
}
.info1,
.info2 {
.block1 {
// width: 300rpx;
// height: 160rpx;
flex-direction: column;
display: inline-block;
height: 100%;
text-align: center;
.block1_1 {
height: 100%;
padding: 0 20rpx;
flex-direction: column;
}
}
.info1_img {
width: 140rpx;
height: 140rpx;
margin-right: 10rpx;
border-radius: 20rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.tip1 {
margin-top: 33rpx;
font-size: 26rpx;
font-weight: bold;
color: #000000;
}
.tip2 {
font-size: 24rpx;
font-weight: 400;
color: #666666;
margin-top: 15rpx;
}
.quan1 {
border-radius: 50%;
border: 3rpx solid #f1f1f1;
width: 30rpx;
height: 30rpx;
margin-top: 21rpx;
&.is-select {
display: flex;
background-color: #fff;
border-color: #fff;
align-items: center;
justify-content: center;
}
.quan2 {
border-radius: 50%;
background: #000000;
width: 14rpx;
height: 14rpx;
}
}
}
.info2 .block1 {
padding: 0 16rpx;
}
}
.popbox {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 30rpx;
background: #fff;
position: relative;
padding-top: 52rpx;
padding-bottom: 40rpx;
}
.popbox > .closeicon1 {
position: absolute;
right: 20rpx;
top: 20rpx;
width: 24rpx;
height: 24rpx;
}
.popbox > .closeicon2 {
width: 130rpx;
margin: auto;
}
.popbox > .tip {
font-weight: bold;
font-size: 30rpx;
text-align: center;
margin-top: 27rpx;
color: #030000;
}
.popbox > .tip2 {
font-weight: bold;
font-size: 30rpx;
text-align: center;
margin-top: 20rpx;
}
.popbox2 {
}
.popbox2 > .title {
text-align: center;
font-weight: bold;
font-size: 32rpx;
padding: 20rpx 0;
color: #212121;
}
.popbox2 > .tipimg {
margin: 20rpx 28rpx 0;
}
.popbox2 > .tipvideo {
margin: 20rpx 28rpx 0;
width: calc(100% - 28rpx - 28rpx);
height: 630rpx;
}
.popbox2 > .tiptext {
text-align: center;
color: #666666;
margin-top: 30rpx;
padding: 0 20rpx;
font-size: 28rpx;
}
.popbox2 > .popbox2btn > .nextbtn {
background: #000;
width: 270rpx;
height: 90rpx;
/*padding: 0 74rpx;*/
text-align: center;
color: #fff;
font-size: 30rpx;
line-height: 90rpx;
/*margin: 50rpx auto 30rpx;*/
border-radius: 45rpx;
box-sizing: border-box;
}
.popbox2 > .popbox2btn > .prebtn {
width: 270rpx;
height: 90rpx;
/*padding: 0 74rpx;*/
text-align: center;
color: #000;
font-size: 30rpx;
line-height: 90rpx;
/*margin: 40rpx auto 30rpx;*/
border-radius: 45rpx;
border: 1px solid #000;
margin-right: 20rpx;
box-sizing: border-box;
}
.popbox2btn {
display: flex;
align-items: center;
justify-content: center;
padding: 73rpx 54rpx 44rpx;
}
.finish-tips {
margin-bottom: 80rpx;
font-size: 36rpx;
color: #030000;
text-align: center;
font-weight: bold;
}
.finish-icon {
width: 120rpx;
height: 120rpx;
}
.finish-btn {
background: #000;
width: 270rpx;
height: 90rpx;
text-align: center;
color: #fff;
font-size: 30rpx;
line-height: 90rpx;
margin: 40rpx auto 0;
border-radius: 45rpx;
}

@ -0,0 +1,333 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import {
Block,
View,
Video,
Text,
Image,
Input,
Button,
ScrollView,
Textarea,
Canvas,
} from "@tarojs/components";
import Navbar from "@/components/navbar/navbar";
import { InstrumentInfo } from "@/utils/Interface";
import "./index.less";
import { contraction, getImgInfo } from "@/utils/compressImage";
import PopupAlert from "@/components/popup/popup-alert";
export default class InstrumentClickInUpload extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "仪器打卡上传",
year: new Date().getFullYear(),
month: String(new Date().getMonth() + 1).padStart(2, "0"),
day: String(new Date().getDate()).padStart(2, "0"),
zkmoshiindex: 0,
moshiindex: null,
buzhouindex: null,
autoplay: false,
scrollleft: 0,
sysinfo: Taro.getSystemInfoSync(),
showVideoPlayBtn: true,
duration: 0,
punchInInfo: {
imageList: [],
content: "",
instrumentId: "84",
},
// 现在选中的数据
currentInfo: {
modeVideo: "",
},
modeInfo: [],
isModeLock: false,
};
}
async onLoad() {
this.initData();
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {
this.firstNurseInfo();
this.modeInfoList();
}
firstNurseInfo = async () => {
let res = await InstrumentInfo.firstNurseInfo({
instrumentId: "84",
});
console.log("firstNurseInfo", res);
};
modeInfoList = async () => {
let res = await InstrumentInfo.modeInfoList({
instrumentId: "84",
});
console.log("modeInfo", res);
if (res.data.code === 200) {
if (res.data.data.length) {
this.setState({
currentInfo: res.data.data[0],
modeInfo: res.data.data,
});
}
}
};
bindMoshi = async (index) => {
let { currentInfo, modeInfo, punchInInfo } = this.state;
currentInfo = modeInfo[index];
this.setState({ zkmoshiindex: index, currentInfo });
};
// 选择图片上传
handleChooseImage = async () => {
let { punchInInfo } = this.state;
Taro.chooseMedia({
count: 1,
mediaType: ["image"],
sourceType: ["album", "camera"],
sizeType: ["compressed"],
camera: "back",
success: async (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
let img = await getImgInfo(tempFilePath);
let compressImage = await contraction(img, "compressImage");
// 压缩后文件地址
let compressTempFilePath = compressImage.tempFilePath;
punchInInfo.imageList.push(compressTempFilePath);
this.setState({ punchInInfo });
},
});
};
handleDeleteImage = async (index) => {
let { punchInInfo } = this.state;
punchInInfo.imageList.splice(index, 1);
this.setState({ punchInInfo });
};
onModeLockOpen = async () => {
this.setState({ isModeLock: true });
};
onModeLockClose = async () => {
this.setState({ isModeLock: false });
};
onTipShow = async () => {};
handleSubmit = async () => {};
render() {
let {
name,
duration,
showVideoPlayBtn,
scrollleft,
zkmoshiindex,
punchInInfo,
tipshow,
currentInfo,
modeInfo,
isModeLock,
} = this.state;
return (
<Block>
<Navbar titleSlot="打卡上传" isBack={true} />
<Canvas
style="height: 0"
id="compressImage"
canvasId="compressImage"
type="2d"
></Canvas>
<PopupAlert
isShow={isModeLock}
title="提示"
content="该模式即将上线,敬请期待"
confirmButtonText="知道了"
textAlgin="center"
isClose={false}
close={this.onModeLockClose}
confirm={this.onModeLockClose}
></PopupAlert>
<View className="infobox1 flex aitems jcenter">
<View className="img">
<Video
src={currentInfo.modeVideo}
id="myVideo"
enableProgressGesture={false}
controls={true}
autoplay={false}
loop={false}
showMuteBtn={true}
onTimeUpdate={this.Videobindtimeupdate}
onEnded={this.videoEnded}
onPause={this.videoPause}
onPlay={this.videoPlay}
showCenterPlayBtn={false}
onLoadedMetaData={this.videoLoadedMetaData}
style="width: 100%; height: 100%;border-radius: 30rpx;"
/>
{showVideoPlayBtn && (
<View className="video-cover">
<Image
className="video-cover-icon"
src={require("../../img/fr200/play.png")}
onClick={this.onPlayTap}
></Image>
{duration && (
<View className="Video-cover-time">{duration}</View>
)}
</View>
)}
</View>
</View>
<View className="infobox3">
<ScrollView
style="white-space: nowrap; height: 100%;"
scroll-x={true}
scroll-left={scrollleft}
>
{modeInfo.map((item, index) => {
return (
<View
className="info1"
onClick={this.bindMoshi.bind(this, index)}
key={index}
>
<View
className="flex aitems"
style="height: 100%; {{zkmoshiindex == index ? 'background: linear-gradient(90deg, #EFDCC2, #FFF2DF)': ''}}"
>
<View className="block1">
<View
className="block1_1 flex aitems "
style="min-width: 80rpx"
>
<View className="tip1">{item.modeName}</View>
<View className="tip2">{item.modeDesc}</View>
{!item.lock && zkmoshiindex !== index && (
<View className="quan1"></View>
)}
{!item.lock && zkmoshiindex == index && (
<View className="quan1 is-select flex aitems jcenter">
<View className="quan2"></View>
</View>
)}
{item.lock && (
<View className="icon">
<Image
src="/img/fr200/suo.png"
mode="aspectFill"
></Image>
</View>
)}
</View>
</View>
{item.modeBanner && (
<View className="info1_img">
<Image src={item.modeBanner} mode="aspectFill" />
</View>
)}
</View>
</View>
);
})}
</ScrollView>
</View>
<View className="infobox2">
<View className="infobox2_info">
<View className="info4">
<View className="upload_header flex aitems sb">
<View className="upload_title"></View>
<View className="icon" onClick={this.onTipShow}>
<Image
src={require("../../img/clock_in_upload/info.png")}
mode="aspectFill"
></Image>
</View>
</View>
<View className="imgbox flex aitems">
{punchInInfo.imageList.length > 0 &&
punchInInfo.imageList.map((item, index) => {
return (
<View className="img" key={"clickin_" + index}>
<Image src={item}></Image>
<View
className="close flex aitems jcenter"
data-index="{{index}}"
onClick={this.handleDeleteImage}
>
<Image
src={require("../../img/fr200/close_white.png")}
mode="widthFix"
></Image>
</View>
</View>
);
})}
{punchInInfo.imageList.length < 3 && (
<View
className="img2 flex aitems jcenter"
onClick={this.handleChooseImage}
>
<Image
src={require("../../img/fr200/add-Image.png")}
mode="aspectFill"
></Image>
</View>
)}
</View>
<View className="content">
{!tipshow && (
<Textarea
placeholder-className="placeholder"
maxlength={120}
onInput={this.handleTextareaInput}
value={punchInInfo.content}
placeholder="请记录一下今天打卡的心得吧~"
></Textarea>
)}
{tipshow && (
<View className="Textarea">
{punchInInfo.content
? punchInInfo.content
: "请记录一下今天打卡的心得吧~"}
</View>
)}
</View>
</View>
</View>
</View>
<View className="confirm_btn flex aitems" onClick={this.handleSubmit}>
<View className="btn"></View>
</View>
</Block>
);
}
}

@ -0,0 +1,156 @@
page {
background: #f8f8f8;
padding-bottom: calc(env(safe-area-inset-bottom));
}
.list {
margin: 26rpx 30rpx 0rpx;
border-radius: 50rpx;
padding-bottom: 0rpx;
overflow: hidden;
position: relative;
height: calc(166rpx * 2);
}
.list > .instrument_img {
position: relative;
height: 100%;
/* top: -250rpx; */
}
.list > .instrument_img .bind_status {
position: absolute;
top: 40rpx;
font-size: 24rpx;
left: 40rpx;
padding: 6rpx 40rpx;
background: linear-gradient(90deg, #fff0da, #ffe4c0);
border-radius: 30rpx;
}
.list > .instrument_img .titile {
position: absolute;
top: 110rpx;
left: 40rpx;
font-weight: bold;
font-size: 32rpx;
z-index: 99;
}
.list > .instrument_img .iot_versions {
position: absolute;
bottom: 40rpx;
left: 40rpx;
/* font-weight: bold; */
font-size: 26rpx;
color: #666666;
z-index: 99;
}
.list > .name {
position: absolute;
bottom: 0;
color: #000;
font-size: 30rpx;
font-weight: bold;
padding: 30rpx;
}
.list > .bindbtn {
background: #cab18c;
position: absolute;
right: 6rpx;
top: 6rpx;
font-size: 24rpx;
border-radius: 56rpx;
width: 134rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
text-align: center;
color: #fff;
}
.list > .bindbtn2 {
background: rgba(255, 255, 255, 0.6);
position: absolute;
right: 6rpx;
top: 6rpx;
font-size: 24rpx;
border-radius: 56rpx;
width: 134rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
color: #000;
}
.infobox1 {
.box {
.tip {
color: #d3bc8c;
font-size: 24rpx;
padding: 30rpx 30rpx 20rpx;
}
.tip2 {
padding: 30rpx 36rpx 30rpx 30rpx;
font-size: 28rpx;
color: #030000;
font-weight: 500;
display: flex;
align-items: center;
image {
width: 44rpx;
}
}
.inputbox {
width: 690rpx;
height: 80rpx;
background: #f2f2f2;
border: 1px solid #dddddd;
border-radius: 3rpx;
padding: 24rpx 28rpx;
margin: 0 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
border: 1px solid #dddddd;
font-weight: 500;
box-sizing: border-box;
input {
width: 100%;
font-size: 28rpx;
}
.share_icon {
width: 42rpx;
}
.bottom_icon {
width: 20rpx;
}
.value {
font-size: 28rpx;
}
.picker {
position: absolute;
width: 100%;
top: 0;
bottom: 0;
left: 0;
z-index: 99;
opacity: 0;
}
.picker view {
position: absolute;
width: 100%;
top: 0;
bottom: 0;
left: 0;
z-index: 99;
opacity: 0;
}
}
.serial_img {
width: 160rpx;
height: 160rpx;
margin: 0rpx 30rpx 20rpx;
border-radius: 20rpx;
}
.infobox1 text {
color: #d71229;
}
}
}

@ -0,0 +1,134 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import Navbar from "../../components/navbar/navbar";
import "./index.less";
import { getStorageSync } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
export default class InstrumentDetail extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "InstrumentDetail",
info: {},
};
}
async onLoad() {
this.initData();
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {
let objStr = getStorageSync("instrument_detail");
if (objStr) {
let info = JSON.parse(objStr);
this.bindingInstrumentInfo(info.id);
}
}
bindingInstrumentInfo = async (id: string | number = "") => {
let res = await InstrumentInfo.bindingInstrumentInfo({
instrumentId: id,
});
if (res.data.code === 200) {
this.setState({ info: res.data.data });
}
};
render() {
let { info } = this.state;
return (
<Block>
<Navbar titleSlot="设备信息" background="#fff" isBack={true} />
<Block>
<View className="list">
<View className="instrument_img">
<Image src={info.instrumentBanner} />
<View className="bind_status"></View>
<View className="titile">{info.instrumentName}</View>
{/* {info.iot == 2 && (
<View className="iot_versions">
{info.iot_versions}
</View>
)} */}
</View>
</View>
</Block>
<View className="infobox1">
<View className="box">
<View className="tip2"></View>
<View className="inputbox">
<Input
type="text"
disabled={true}
placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;"
placeholder={info.bindingSerial}
/>
</View>
</View>
<View className="box">
<View className="tip2"></View>
<Image
className="serial_img"
src={info.bindingSerialImage}
mode="aspectFill"
/>
</View>
<View className="box">
<View className="tip2"></View>
<View className="inputbox">
<Input
type="text"
disabled={true}
placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;"
placeholder={info.updateTime}
/>
</View>
</View>
<View className="box">
<View className="tip2"></View>
<View className="inputbox">
<Input
type="text"
disabled={true}
placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;"
placeholder={info.instrumentGuarantee + "年"}
/>
</View>
</View>
{info.id == 74 ||
(info.id == 73 && (
<View className="box">
<View className="tip2"></View>
<View className="inputbox">
<Input
type="text"
disabled={true}
placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;"
placeholder="花至FLOSSOM.V01.00.00.230316"
/>
</View>
</View>
))}
</View>
</Block>
);
}
}

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "设备管理",
});

@ -0,0 +1,180 @@
page {
background: #f8f8f8;
padding-bottom: calc(env(safe-area-inset-bottom));
}
.instrument_box {
.title {
margin: 35rpx 37rpx;
font-size: 32rpx;
font-weight: bold;
color: #030000;
}
}
.bind_list,
.un_bind_list {
width: 100%;
white-space: nowrap;
// margin-left: 37rpx;
}
.un_bind_list {
margin-left: 37rpx;
}
.bind_list {
height: 650rpx;
.wrapper {
display: inline-block;
position: relative;
width: 661rpx;
margin-right: 16rpx;
.bind_status {
position: absolute;
top: 40rpx;
font-size: 24rpx;
left: 40rpx;
padding: 6rpx 40rpx;
background: linear-gradient(90deg, #fff0da, #ffe4c0);
border-radius: 30rpx;
}
}
.cover {
display: inline-block;
position: relative;
width: 661rpx;
height: 350rpx;
border-radius: 50rpx;
overflow: hidden;
background: #fff;
box-sizing: border-box;
.image {
width: 100%;
height: 350rpx;
}
.title {
font-size: 26rpx;
font-weight: bold;
text-align: center;
color: #000000;
width: 100%;
line-height: 1;
margin: 30rpx 0;
box-sizing: border-box;
}
.intro {
position: absolute;
left: 40rpx;
bottom: 38rpx;
display: flex;
align-items: center;
justify-content: center;
margin-top: 10rpx;
.tips {
font-size: 26rpx;
font-weight: 500;
color: #666666;
text-align: center;
}
.right {
width: 26rpx;
margin-left: 5rpx;
display: inline;
}
}
}
.bind_cont {
.title {
text-align: center;
font-size: 36rpx;
font-weight: bold;
color: #000000;
}
.bindinfo {
/* display: block; */
margin: 0 auto;
width: 240rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
/* background: transparent; */
border-radius: 60rpx;
border: 1px solid #000000;
font-size: 26rpx;
color: #000000;
box-sizing: border-box;
}
}
}
.un_bind_list {
.wrapper {
display: inline-block;
position: relative;
width: 335rpx;
margin-right: 16rpx;
}
.cover {
display: inline-block;
position: relative;
width: 335rpx;
height: 330rpx;
border-radius: 30rpx;
overflow: hidden;
background: #fff;
box-sizing: border-box;
.image {
display: block;
width: 100%;
height: 177rpx;
}
.name {
font-size: 26rpx;
font-weight: bold;
text-align: center;
color: #000000;
width: 100%;
line-height: 1;
margin: 30rpx 0;
box-sizing: border-box;
}
.buy {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10rpx;
.tips {
font-size: 26rpx;
font-weight: 500;
color: #666666;
text-align: center;
}
.right {
width: 26rpx;
margin-left: 5rpx;
display: inline;
}
}
}
.bind_cont {
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx 0;
.tobind {
width: 160rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background: #000000;
border-radius: 50rpx;
font-size: 26rpx;
color: #ffffff;
}
}
}
.scroll {
width: 100%;
overflow: hidden;
}

@ -0,0 +1,274 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import {
Block,
View,
Text,
Image,
Input,
Button,
ScrollView,
Swiper,
SwiperItem,
} from "@tarojs/components";
import "./index.less";
import Navbar from "../../components/navbar/navbar";
import { InstrumentInfo } from "../../utils/Interface";
import { go, msg, setStorageSync } from "../../utils/traoAPI";
export default class InstrumentManage extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "InstrumentManage",
userinfo: {},
imgUrl: "",
imgUrl2: "",
list: [],
bindList: [],
unBindList: [],
page: 1,
isback: false,
//全局参数
appdata: {},
tipshow: false,
FR200LIST: [],
devinfo: {},
current: 0,
};
}
async onLoad() {
this.initData();
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {
this.bindingInstrumentList();
this.unbindingInstrumentInfoList();
}
// 获取已绑定仪器列表
bindingInstrumentList = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { data: res } = await InstrumentInfo.bindingInstrumentList();
Taro.hideLoading();
if (res.code === 200) {
this.setState({ bindList: res.data });
} else {
// 仪器列表失败todo
}
};
// 获取未绑定仪器列表
unbindingInstrumentInfoList = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { data: res } = await InstrumentInfo.unbindingInstrumentInfoList();
Taro.hideLoading();
if (res.code === 200) {
this.setState({ unBindList: res.data });
} else {
// 仪器列表失败todo
}
};
goIntro(item) {
let bindid = item.id;
go("/pages/introduce/introduce?id=" + bindid);
}
goBind(item) {
let bindid = item.id;
go("/pages/instrument/instrument?id=" + bindid);
}
goBindInfo(item) {
// let bindid = item.id;
setStorageSync("instrument_detail", JSON.stringify(item));
go("/pages/instrument_detail/index");
}
async lesgobuy(item) {
console.log(item);
// if (item.programs_json) {
// item.programs_json = JSON.parse(item.programs_json);
// // console.log(item.programs_json)
// Taro.navigateToMiniProgram({
// appId: item.programs_json.buylink,
// path: item.programs_json.buypath,
// envVersion: "release",
// success(res) {
// // 打开成功
// },
// fail() {},
// });
// } else {
// msg("暂无购买链接");
// }
}
render() {
let { bindList, unBindList, current } = this.state;
return (
<Block>
<Navbar titleSlot="设备管理" background="#fff" isBack={true} />
<View className="instrument_box">
{bindList.length && (
<Block>
<View className="title"></View>
<View className="scroll">
<Swiper
className="bind_list"
current={current}
duration={800}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
previousMargin="32rpx"
nextMargin="32rpx"
>
{bindList.map((item: any, index: number) => {
return (
<SwiperItem key={index}>
<View className="wrapper" key={"bind_" + index}>
<View className="cover" onClick={this.goIntro}>
<Image
className="Image"
src={item.banner}
mode="aspectFill"
></Image>
<View className="bind_status"></View>
<View className="intro">
<View className="tips" onClick={this.goIntro}>
</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="title">{item.name}</View>
<View
className="bindinfo"
onClick={this.goBindInfo.bind(this, item)}
>
</View>
</View>
</View>
</SwiperItem>
);
})}
</Swiper>
{/* <ScrollView scroll-x="true" className="bind_list">
{bindList.map((item, index) => {
if (item.status === 0) {
return (
<View className="wrapper" key={"bind_" + index}>
<View className="cover" onClick={this.goIntro}>
<Image
className="Image"
src={item.banner}
mode="aspectFill"
></Image>
<View className="bind_status"></View>
<View className="intro">
<View className="tips" onClick={this.goIntro}>
</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="title">{item.name}</View>
<View
className="bindinfo"
onClick={this.goBindInfo.bind(this, item)}
>
</View>
</View>
</View>
);
}
})}
</ScrollView> */}
</View>
</Block>
)}
<View className="title"></View>
<View className="scroll">
<ScrollView scroll-x="true" className="un_bind_list">
{unBindList.map((item, index) => {
if (item.status === 0) {
return (
<View className="wrapper" key={index}>
<View
className="cover"
onClick={this.lesgobuy.bind(this, item)}
>
<Image
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
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>
);
}
})}
</ScrollView>
</View>
</View>
</Block>
);
}
}

@ -107,12 +107,12 @@ class IntegralList extends Component<any, any> {
envVersion: otherSetting.envVersion,
success() {
// 打开成功
// Taro.reLaunch({
// Taro.switchTab({
// url: "/pages/index/index",
// });
},
fail() {
// Taro.reLaunch({
// Taro.switchTab({
// url: "/pages/index/index",
// });
},
@ -143,6 +143,10 @@ class IntegralList extends Component<any, any> {
// 用户是否已关闭提醒
GetOfficialAccount = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let res = await GetOfficialAccount();
if (res.data.code === 200) {
if (!res.data.data) {
@ -153,8 +157,11 @@ class IntegralList extends Component<any, any> {
};
// 用户是否关注公众号
GetIsAttentionOfficialAccount = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let res = await GetIsAttentionOfficialAccount();
console.log("GetIsAttentionOfficialAccount", res);
if (res.data.code === 200) {
if (!res.data.data) {
// 如果false则是没关注
@ -174,6 +181,10 @@ class IntegralList extends Component<any, any> {
};
GetObtainUserIntegral = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { list, pageNum, pageSize } = this.state;
let res = await GetObtainUserIntegral({
pageNum,
@ -195,6 +206,10 @@ class IntegralList extends Component<any, any> {
};
GetIntegralRule = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let res = await GetIntegralRule();
console.log("GetIntegralRule", res);
if (res.data.code === 200) {
@ -378,7 +393,7 @@ class IntegralList extends Component<any, any> {
confirm={this.officialPopupConfirm}
/>
<Navbar titleSlot="我的积分" isBack={true}/>
<Navbar titleSlot="我的积分" isBack={true} />
<View style="background: #f3f3f3;padding: 33rpx 30rpx 31rpx 30rpx;">
<View className="integral_box1">

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

@ -58,12 +58,12 @@ class Shop extends Component<any, any> {
// sysVersion: otherSetting.sysVersion,
success(res) {
// 打开成功
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
},
fail(res) {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
},

@ -116,6 +116,11 @@ class User extends Component<any, any> {
});
};
// 开发中弹窗
devOpen = (e) => {
this.setState({ isDev: true });
};
// 不检查登录跳转
goUrlNoRegister = (e) => {
let url = e.currentTarget.dataset.url;
@ -192,7 +197,7 @@ class User extends Component<any, any> {
return (
<Block>
<PopupAlert
{/* <PopupAlert
isShow={isDev}
isClose={true}
title="提示"
@ -201,7 +206,7 @@ class User extends Component<any, any> {
textAlgin="center"
close={this.closeDev}
confirm={this.closeDev}
/>
/> */}
<PopupAlert
isShow={isNotRegister}
isClose={true}
@ -264,10 +269,9 @@ class User extends Component<any, any> {
<View className="info2 flex aitems sa">
<View
className="block"
data-url="/pages/instrument_manage/instrument_manage?isback=1"
onClick={() => {
this.setState({ isDev: true });
}}
data-url="/pages/instrument_manage/index?isback=1"
onClick={this.goUrlNoRegister}
// onClick={this.devOpen}
>
<Image
className="bg_img"

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

@ -252,7 +252,7 @@ class UserInfoDetail extends Component<any, any> {
};
goUser = () => {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/user/user",
});
};

@ -30,6 +30,7 @@ export default class WebViewPage extends Component<any, any> {
if (!url?.includes("https://") && !url?.includes("http://")) {
url = "https://" + url;
}
console.log("url", url);
this.setState({ url: url });
}

@ -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,35 @@
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 }) {
console.log("payload", 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,8 +50,9 @@ export const UpdateUserUploadFile = (formData) => {
// 更新用户信息且上传头像文件
return AjaxUploadFile(
{
url: "/hzwx/user/updateUser",
url: "/user/updateUser",
filePath: formData.file,
name: "file",
},
formData
);
@ -59,7 +60,7 @@ export const UpdateUserUploadFile = (formData) => {
export const RefreshWxUserInfo = (data) => {
// 刷新用户信息
return Ajax({
url: "/hzwx/user/refreshWxUserInfo",
url: "/user/refreshWxUserInfo",
data,
method: "get",
});
@ -67,7 +68,7 @@ export const RefreshWxUserInfo = (data) => {
export const GetProvince = (data) => {
// 获取全部省份
return Ajax({
url: "/hzwx/region/getProvince",
url: "/region/getProvince",
data,
method: "get",
});
@ -75,7 +76,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 +87,7 @@ export const GetUserMobile = (data = { code: "" }) => {
}
//获取用户手机号码
return Ajax({
url: "/hzwx/user/upgradeMember" + paramsToUrlQueryString(data),
url: "/user/upgradeMember" + paramsToUrlQueryString(data),
data,
method: "post",
});
@ -96,14 +97,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 +112,7 @@ export const getPrivacyAgreement = (data) => {
export const GetOtherSetting = (data) => {
// 获取其他设置
return Ajax({
url: "/hzwx/setting/getOtherSetting",
url: "/setting/getOtherSetting",
data,
method: "get",
});
@ -119,7 +120,7 @@ export const GetOtherSetting = (data) => {
export const getContactWorker = (data) => {
// 联系客服
return Ajax({
url: "/hzwx/setting/getContactWorker",
url: "/setting/getContactWorker",
data,
method: "get",
});
@ -127,7 +128,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 +138,7 @@ export const SaveMessage = (data) => {
export const GetNoReadMessageNum = (data) => {
// 查询是否有消息未读
return Ajax({
url: "/hzwx/userScriptLog/getNoReadMessageNum",
url: "/userScriptLog/getNoReadMessageNum",
data,
method: "get",
});
@ -146,7 +147,7 @@ export const GetNoReadMessageNum = (data) => {
export const GetHasBeenRead = (data) => {
// 将消息设置为已读
return Ajax({
url: "/hzwx/userScriptLog/hasBeenRead",
url: "/userScriptLog/hasBeenRead",
data,
method: "get",
});
@ -155,7 +156,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 +166,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 +174,7 @@ export const GetObtainUserIntegral = (data) => {
export const GetIntegralRule = (data) => {
// 获取积分规则
return Ajax({
url: "/hzwx/setting/getIntegralRule",
url: "/setting/getIntegralRule",
data,
method: "get",
});
@ -181,7 +182,7 @@ export const GetIntegralRule = (data) => {
export const GetIsAttentionOfficialAccount = (data) => {
// 查询用户是否关注公众号
return Ajax({
url: "/hzwx/noRemind/isAttentionOfficialAccount",
url: "/noRemind/isAttentionOfficialAccount",
data,
method: "get",
});
@ -189,7 +190,7 @@ export const GetIsAttentionOfficialAccount = (data) => {
export const GetOfficialAccount = (data) => {
// 查询用户是否关闭提醒关注公众号
return Ajax({
url: "/hzwx/noRemind/getOfficialAccount",
url: "/noRemind/getOfficialAccount",
data,
method: "get",
});
@ -197,7 +198,7 @@ export const GetOfficialAccount = (data) => {
export const GetCloseOfficialAccount = (data) => {
// 查询关闭提醒关注公众号
return Ajax({
url: "/hzwx/noRemind/closeOfficialAccount",
url: "/noRemind/closeOfficialAccount",
data,
method: "get",
});
@ -206,7 +207,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 +215,7 @@ export const GetSitePopupList = (data) => {
export const GetSiteCarousel = (data) => {
// 站点管理-轮播图
return Ajax({
url: "/hzwx/siteInfo/carousel",
url: "/siteInfo/carousel",
data,
method: "get",
});
@ -222,7 +223,7 @@ export const GetSiteCarousel = (data) => {
export const GetSiteAddTag = (data) => {
// 站点管理-轮播图-添加标签 传值是id
return Ajax({
url: "/hzwx/siteInfo/addTag/" + data,
url: "/siteInfo/addTag/" + data,
data,
method: "get",
});
@ -230,79 +231,190 @@ export const GetSiteAddTag = (data) => {
// 仪器管理
export const InstrumentInfo = {
// serial 序列号
/**根据序列号获取仪器信息 serial 序列号*/
getInstrumentInfoBySerial: (data) => {
// 根据序列号获取仪器信息
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",
});
},
/**更换绑定仪器*/
exchangeBinding: (data) => {
// 更换绑定仪器
return Ajax({
url: "/hzwx/instrument/exchangeBinding" + paramsToUrlQueryString(data),
url: "/instrument/exchangeBinding" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**获取当前用户:已绑定仪器列表*/
bindingInstrumentList: () => {
// 获取当前用户:已绑定仪器列表
return Ajax({
url: "/hzwx/instrument/bindingInstrumentList",
url: "/instrument/bindingInstrumentList",
data,
method: "get",
});
},
/**获取当前用户:未绑定仪器列表*/
unbindingInstrumentInfoList: () => {
// 获取当前用户:未绑定仪器列表
return Ajax({
url: "/hzwx/instrument/unbindingInstrumentInfoList",
url: "/instrument/unbindingInstrumentInfoList",
data,
method: "get",
});
},
manualCodeBinding: (data) => {
// 用户手动绑定仪器
/**获取当前用户:绑定记录 instrumentId*/
bindingInstrumentInfo: (data) => {
return Ajax({
url: "/hzwx/instrument/manualCodeBinding",
url: "/instrument/bindingInstrumentInfo" + paramsToUrlQueryString(data),
data,
method: "post",
method: "get",
});
},
/**用户手动绑定仪器 file 图片文件*/
manualCodeBinding: (formData) => {
return AjaxUploadFile(
{
url: "/instrument/manualCodeBinding",
filePath: formData.serialImage,
name: "serialImage",
},
formData
);
},
/**用户扫码绑定仪器 serial instrumentId*/
scanCodeBinding: (data) => {
return Ajax({
url: "/instrument/scanCodeBinding" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**根据仪器ID获取仪器介绍信息 instrumentId*/
instructionInfo: (data) => {
// 根据仪器ID获取仪器介绍信息 instrumentId
return Ajax({
url: "/instrument/instructionInfo" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**根据仪器ID获取仪器的初次护理信息*/
firstNurseInfo: (data) => {
// 根据仪器ID获取仪器的初次护理信息
return Ajax({
url: "/hzwx/instrument/firstNurseInfo" + paramsToUrlQueryString(data),
url: "/instrument/firstNurseInfo" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
modeInfo: (data) => {
// 根据仪器ID获取仪器模式
/**根据仪器ID获取仪器模式列表*/
modeInfoList: (data) => {
return Ajax({
url: "/hzwx/instrument/modeInfo" + paramsToUrlQueryString(data),
url: "/instrument/modeInfoList" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**获取设备升级数据 instrumentId*/
getUpgrade: (data) => {
return Ajax({
url: "/instrument/upgrade" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**打卡相关*/
clock: {
/**添加用户使用仪器记录 instrumentId*/
addClockInstrument: (data) => {
return Ajax({
url: "/clock/addClockInstrument" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**用户打卡*/
postInsertClockLog: (data) => {
return Ajax({
url: "/clock/insertClockLog",
data,
method: "post",
});
},
/**查询用户当天最新的一条打卡记录*/
getLatestClockRecord: (data) => {
return Ajax({
url: "/clock/latestClockRecord",
data,
method: "get",
});
},
/**分页获取用户的打卡记录 page size*/
getList: (data) => {
return Ajax({
url: "/clock/list" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**分页获取打卡统计*/
getClockStatistics: (data) => {
return Ajax({
url: "/clock/clockStatistics",
data,
method: "get",
});
},
},
/**护理相关*/
nursingLog: {
/**新增用户护理日志*/
addLog: (data) => {
return Ajax({
url: "/nursingLog/add",
data,
method: "post",
});
},
/**查询用户护理记录*/
getRecord: (data) => {
return Ajax({
url: "/nursingLog/record" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
/**查询用户护理记录的当月统计信息*/
getStatistics: (data) => {
return Ajax({
url: "/nursingLog/statistics" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
},
};
//localhost:9204/instrument/getInstrumentInfoBySerial

@ -1,4 +1,11 @@
import { go, back, showModal, setStorageSync, getStorageSync } from "./traoAPI";
import {
go,
back,
showModal,
setStorageSync,
getStorageSync,
loading,
} from "./traoAPI";
import { WCUserLogin } from "./Interface";
import Taro from "@tarojs/taro";
import formdata from "./wxFormdata/formData";
@ -20,6 +27,8 @@ export const Ajax = (params) => {
// mask: true,
// });
const whiteListLoading = [""]; // loading
// 防止多次点击
const requestUrlList = global_requestUrlList;
const whiteList = []; // 白名单:不自动重新请求
@ -42,14 +51,15 @@ export const Ajax = (params) => {
},
data: params.data,
success(res) {
if (res.statusCode !== 200) {
if (res.statusCode == 401 || res.data.code == 403) {
// 自动重新登录
setStorageSync("token", null);
loginReload(params);
console.log("res", res);
if (res.data.code == 401 || res.data.code == 403) {
// 自动重新登录
Taro.removeStorageSync("token");
loginReload(params);
return;
}
return;
}
if (res.statusCode !== 200) {
Taro.showModal({
title: "提示",
content: String("错误码:" + res.statusCode),
@ -57,11 +67,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
@ -71,7 +78,12 @@ export const Ajax = (params) => {
return false;
}
reject(res);
Taro.showModal({
title: "提示",
content: String(res.data.msg),
showCancel: false,
});
// reject(res);
return false;
}
@ -90,7 +102,10 @@ export const Ajax = (params) => {
// });
},
complete() {
// Taro.hideLoading();
if (requestUrlList.length === 0) {
Taro.hideLoading();
}
// const requestUrlList = global_requestUrlList;
// const newRequestUrlList = requestUrlList.splice(
// requestUrlList.indexOf(params.url),
@ -111,8 +126,8 @@ export const AjaxUploadFile = (params, formData) => {
return new Promise((reslove, reject) => {
let token = getStorageSync("token");
Taro.uploadFile({
filePath: params.filePath,
name: "file",
filePath: params.filePath, // 上传文件地址
name: params.name || "file", // 上传文件字段
url: domain + params.url,
formData: {
...formData,
@ -185,13 +200,14 @@ export const AjaxFormData = (params) => {
},
data: params.data.buffer,
success(res) {
if (res.data.code == 401 || res.data.code == 403) {
// 自动重新登录
Taro.removeStorageSync("token");
loginReload(params);
return;
}
if (res.statusCode !== 200) {
if (res.statusCode == 401 || res.data.code == 403) {
// 自动重新登录
setStorageSync("token", null);
loginReload(params);
return;
}
Taro.showModal({
t2: String("错误码:" + res.statusCode),
showCancel: false,
@ -221,7 +237,7 @@ export const AjaxFormData = (params) => {
res.data.msg === "登录状态已过期"
) {
// 自动重新登录
setStorageSync("token", null);
Taro.removeStorageSync("token");
loginReload(params);
return;
}
@ -281,7 +297,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,9 +314,9 @@ const loginReload = async (_params) => {
content: "登录已过期,请重新登录",
showCancel: false,
}).then((res) => {
setStorageSync("token", null);
Taro.removeStorageSync("token");
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
Taro.navigateTo({
url: "/pages/initiate/initiate",
});
});

Loading…
Cancel
Save