完成绑定流程

master
blak-kong 2 years ago
parent 92c3ed2fd1
commit a4f5c3be86

@ -14,6 +14,8 @@ export default defineAppConfig({
"pages/register/register",
'pages/instrument/instrument',
"pages/instrument/intro",
"pages/instrument_manage/index",
"pages/instrument_detail/index",
'pages/privacyPolicy/privacyPolicy',
'pages/userPolicy/userPolicy',
'pages/about/about',

@ -24,16 +24,8 @@ class App extends Component<PropsWithChildren> {
return;
}
// 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",
// });
}

@ -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>

@ -15,7 +15,6 @@ 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 ***/
/** 自定义组件 **/
@ -43,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;
@ -419,7 +424,7 @@ class Index extends Component<any, any> {
this.bindingInstrument();
} else {
// 换绑仪器
this.bindingInstrument();
this.exchangeBinding();
}
};
// 根据扫码的序列号获取仪器信息
@ -443,6 +448,7 @@ class Index extends Component<any, any> {
}
// 0已绑定 1未绑定 2已解绑
if (instrumentInfo.bindingStatus === 0) {
// 选择仪器有误
this.setState({
isBeforeBinding: true,
});
@ -501,14 +507,11 @@ class Index extends Component<any, any> {
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 });
}
};
@ -524,8 +527,8 @@ class Index extends Component<any, any> {
});
console.log("exchangeBinding", data);
Taro.hideLoading();
this.closeBinding();
if (data.code === 200) {
this.closeBinding();
} else {
this.closeBinding();
this.setState({ isBindingError: true });
@ -549,7 +552,7 @@ class Index extends Component<any, any> {
// 跳转仪器介绍页
goNursing = (item) => {
console.log("goNursing", item);
this.props.setInstrument(item);
setStorageSync("instrument_item", JSON.stringify(item));
go("/pages/instrument/intro?id=" + item.id);
};
/* 扫码进入逻辑 */
@ -799,8 +802,5 @@ const mapDispatchToProps = (dispatch) => ({
setIndexFlag(data) {
dispatch(setIndexFlag(data));
},
setInstrument(data) {
dispatch(setInstrument(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Index);

@ -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;
}

@ -18,9 +18,13 @@ import {
} 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 {
go,
back,
msg,
setStorageSync,
getStorageSync,
} from "../../utils/traoAPI";
import { getImgInfo, contraction } from "../../utils/compressImage";
@ -45,9 +49,8 @@ export default class Instrument extends Component<any, any> {
channelList: [],
channelInfo: {
id: "",
image: "",
serialImage: "",
serial: "",
bind_intro_Video: "",
},
equipmentList: [
{
@ -127,13 +130,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.serial = bindCode;
this.setState({
bindCode,
channelInfo,
});
}
this.bindingInstrument();
// this.getBindCodeInfo();
setTimeout(() => {
this.scanCodeBinding();
}, 10);
},
fail(err) {},
complete(res) {},
@ -238,6 +244,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 +254,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.serial = "";
this.setState({
channelInfo: item,
isVideo: isVideo(item.bind_intro_video),
isVideo: this.isVideo(item.banner),
});
}
@ -289,38 +285,96 @@ 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];
this.setState({
equipmentList: data.data,
channelInfo: item,
isVideo: this.isVideo(item.banner),
});
}
}
};
// 绑定仪器
bindingInstrument = async () => {
manualCodeBinding = 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.manualCodeBinding({
serial: channelInfo.serial,
serialImage: channelInfo.serialImage,
instrumentId: channelInfo.id,
});
console.log("bindingInstrument", data);
console.log("bindingInstrument", res);
Taro.hideLoading();
if (data.code === 200) {
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 { channelInfo } = this.state;
let res = await InstrumentInfo.scanCodeBinding({
serial: channelInfo.serial,
instrumentId: channelInfo.id,
});
console.log("bindingInstrument", res);
Taro.hideLoading();
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.serial,
});
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 +395,6 @@ export default class Instrument extends Component<any, any> {
let {
isBindingError,
isBindingCheckError,
isVideo,
channelInfo,
inputType,
style,
@ -397,7 +450,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 +458,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 +476,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 +500,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>
@ -482,7 +538,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
@ -505,16 +566,21 @@ export default class Instrument extends Component<any, any> {
</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")}

@ -4,8 +4,8 @@
background: #fff;
flex-direction: column;
width: 100%;
padding-bottom: 20rpx;
/*padding-bottom: env(safe-area-inset-bottom);*/
padding-bottom: 30rpx;
// padding-bottom: env(safe-area-inset-bottom);
}
.footer .btn {
@ -13,33 +13,41 @@
height: 90rpx;
background: #000;
border-radius: 45rpx;
color: #fff;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #ffffff;
}
.footer .text {
background: transparent;
color: #000;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
.main {
height: 100vh;
text-align: center;
margin: 48rpx 45rpx 0;
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: 474rpx;
height: 488rpx;
background: linear-gradient(rgba(204, 204, 204, 0.4), #fff);
border-radius: 50rpx;
margin-top: 7rpx;
@ -47,11 +55,12 @@
.title {
font-size: 48rpx;
font-family: PingFang SC;
font-weight: 500;
color: #000;
text-align: center;
padding-bottom: 48rpx;
padding-top: 96rpx;
padding-bottom: 30rpx;
padding-top: 84rpx;
}
.text {
@ -60,19 +69,41 @@
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%);
width: 120rpx;
height: 1rpx;
background: #ccc;
}
.dot {
height: 100%;
background: #000;
transition-property: all;
transition-duration: 0.8s;
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;
}
}

@ -5,28 +5,34 @@ import { Component, PropsWithChildren, useEffect, useState } from "react";
import {
Block,
View,
Text,
Image,
Video,
Input,
Button,
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 util from "../../utils/utilhtml";
import "./intro.less";
export default class Intro extends Component<any, any> {
class Intro extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "template模板页",
current: 0,
info: {},
instrument: {},
introList: [],
isNursing: false,
};
@ -35,10 +41,16 @@ export default class Intro extends Component<any, any> {
async onLoad() {}
componentDidMount() {}
componentWillMount() {
console.log("Taro.Current", Taro.Current);
let params = Taro.Current?.router?.params;
if (params) {
this.getInstrumentInfo(params.id);
// 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() {}
@ -51,49 +63,35 @@ export default class Intro extends Component<any, any> {
onChange(event) {
console.info("onchange", event);
const current = event.detail.current;
this.setState({ current });
// const current = event.detail.current;
// this.setState({ current });
}
// 获取设备信息
async getInstrumentInfo(id) {
// const { data: res } = await InstrumentInfo({ id });
let { data: res } = await InstrumentInfo.instructionInfo({
let 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,
// });
// }
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);
}
// 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 { isNursing, info } = this.state;
// if (isNursing) {
// setStorageSync("introduceId", info.id);
// }
const url = "/pages/index/index";
Taro.switchTab({
url,
@ -101,11 +99,22 @@ export default class Intro extends Component<any, any> {
}
render() {
let { name, current, introList, info } = this.state;
let { current, introList, instrument } = this.state;
return (
<Block>
<Navbar titleSlot="仪器绑定" isBack={true} />
<View style="position: relative">
<Swiper className="main" current={current} onChange={this.onChange}>
<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}>
@ -120,23 +129,28 @@ export default class Intro extends Component<any, any> {
)}
<View className="content">
<View className="title">{info.titile}</View>
<View className="text">{item.title}</View>
<View className="title">{instrument.name}</View>
<View className="text">{item.message}</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>
{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">
@ -151,3 +165,13 @@ export default class Intro extends Component<any, any> {
);
}
}
const mapStateToProps = (state) => ({
instrument: state.instrument,
});
const mapDispatchToProps = (dispatch) => ({
setInstrument(data) {
dispatch(setInstrument(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Intro);

@ -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,119 @@
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";
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.setState({ info: info });
}
}
render() {
let { name, info } = this.state;
return (
<Block>
<Navbar titleSlot="设备信息" background="#fff" isBack={true} />
<Block>
<View className="list">
<View className="instrument_img">
<Image src={info.banner} />
<View className="bind_status"></View>
<View className="titile">{info.name}</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.serial}
/>
</View>
</View>
<View className="box">
<View className="tip2"></View>
<Image className="serial_img" src={info.serial} 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.info.warranty_name}
/>
</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",
// });
},
@ -378,7 +378,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,7 +50,7 @@ class Register extends Component<any, any> {
}
onSkip = () => {
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",
});
},

@ -264,10 +264,8 @@ 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}
>
<Image
className="bg_img"

@ -260,7 +260,7 @@ class UserInfo extends Component<any, any> {
const isScan = Taro.getStorageSync("isScan");
if (isScan) {
// Taro.setStorageSync("isScanNotRegisterSkip", true);
Taro.reLaunch({
Taro.switchTab({
url: "/pages/index/index",
});
return;
@ -269,7 +269,7 @@ class UserInfo extends Component<any, any> {
if (isInstrumentJump === "true") {
go("/pages/instrument/instrument");
} else {
Taro.reLaunch({
Taro.switchTab({
url: "/pages/user/user",
});
}

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

@ -25,6 +25,7 @@ const instrumentReducer = createSlice({
},
reducers: {
setInstrument(state, { payload }) {
console.log("payload", payload);
state = JSON.parse(JSON.stringify(payload));
},
},

@ -52,6 +52,7 @@ export const UpdateUserUploadFile = (formData) => {
{
url: "/user/updateUser",
filePath: formData.file,
name: "file",
},
formData
);
@ -279,12 +280,40 @@ export const InstrumentInfo = {
method: "get",
});
},
manualCodeBinding: (data) => {
// 用户手动绑定仪器
bindingInstrumentInfo: () => {
// 获取当前用户:绑定记录 instrumentId
return Ajax({
url: "/instrument/manualCodeBinding",
data,
method: "post",
url: "/instrument/bindingInstrumentInfo" + paramsToUrlQueryString(data),
method: "get",
});
},
// manualCodeBinding: (data) => {
// // 用户手动绑定仪器
// return Ajax({
// url: "/instrument/manualCodeBinding",
// data,
// method: "post",
// });
// },
manualCodeBinding: (formData) => {
// 用户手动绑定仪器 file 图片文件
return AjaxUploadFile(
{
url: "/instrument/manualCodeBinding",
filePath: formData.serialImage,
name: "serialImage",
},
formData
);
},
scanCodeBinding: (data) => {
// 用户扫码绑定仪器 serial instrumentId
return Ajax({
url: "/instrument/scanCodeBinding" + paramsToUrlQueryString(data),
method: "get",
});
},
instructionInfo: (data) => {

@ -109,8 +109,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,
@ -299,7 +299,7 @@ const loginReload = async (_params) => {
}).then((res) => {
Taro.removeStorageSync("token");
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
Taro.navigateTo({
url: "/pages/initiate/initiate",
});
});

Loading…
Cancel
Save