import React from "react"; import { View, Video, Text, Image } from "@tarojs/components"; import Taro from "@tarojs/taro"; import "./index.scss"; import base from "../../config/base"; import { InputBox } from "../../component/input/index"; class Home extends React.Component { static defaultProps = {}; constructor(props: any) { super(props); this.state = { height: 0, data: {}, }; this.getData(); } getImageSize = (e: any) => { const systemInfo = Taro.getSystemInfoSync(); this.setState({ height: (systemInfo.screenWidth / e.detail.width) * e.detail.height, }); }; getData = () => { Taro.showLoading({ title: "加载中", }); Taro.request({ url: base.baseUrlEle + "/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/home.json?data=" + Date.now(), method: "GET", success: (res: any) => { if (res.statusCode !== 200) return Taro.showToast({ title: "请求失败", icon: "none", }); this.setState({ data: res.data || {}, }); Taro.hideLoading(); }, fail: (error: any) => { Taro.hideLoading(); Taro.showToast({ title: JSON.stringify(error), }); }, }); }; render() { // const { } = this.props; const systemInfo = Taro.getSystemInfoSync(); const w = systemInfo.screenWidth - 60; const h = (w / 16) * 9; const sonEle = (item) => ( · {item.title} {item.content} ); return ( {h && this.state.data.baseVideoUrl && ( ); } } export { Home };