import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Block, View, Text, Image, Video, Input, Button, Swiper, SwiperItem, } from "@tarojs/components"; import { InstrumentInfo } from "../../utils/Interface"; import { setStorageSync, getStorageSync, go } from "../../utils/traoAPI"; import util from "../../utils/utilhtml"; import "./intro.less"; export default class Intro extends Component { constructor(props) { super(props); this.state = { name: "template模板页", current: 0, info: {}, introList: [], isNursing: false, }; } async onLoad() {} componentDidMount() {} componentWillMount() { console.log("Taro.Current", Taro.Current); let params = Taro.Current?.router?.params; if (params) { this.getInstrumentInfo(params.id); } } componentWillUnmount() {} componentDidShow() {} componentDidHide() {} async initData() {} onChange(event) { console.info("onchange", event); const current = event.detail.current; this.setState({ current }); } // 获取设备信息 async getInstrumentInfo(id) { // const { data: res } = await InstrumentInfo({ id }); let { data: res } = await InstrumentInfo.instructionInfo({ instrumentId: id, }); console.log("instrumentId", res); // if (res.code === 200) { // const { intro_json } = res.data.info; // if (intro_json) { // try { // res.data.info.intro_json = JSON.parse(intro_json); // } catch (e) { // console.log(e); // } // } // this.setState({ // info: res.data?.info, // introList: res.data?.info?.intro_json, // }); // } } toNursing() { if (this.state.info.iot === 2) { this.setState({ isNursing: true }, () => { this.toHomePage(); }); } else { go("/pages/clock_in2/clock_in2?iid=" + this.state.info.id); } } toHomePage() { const { isNursing, info } = this.state; if (isNursing) { // isNursing ? '/pages/index/index?instrument_id=' + info.id setStorageSync("introduceId", info.id); } const url = "/pages/index/index"; Taro.switchTab({ url, }); } render() { let { name, current, introList, info } = this.state; return ( {introList.map((item: any, index: number) => { return ( {item.fileType === "video" ? ( ); })} 马上护理 暂不护理 ); } }