完成绑定流程
parent
92c3ed2fd1
commit
a4f5c3be86
@ -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,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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue