import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";

import Navbar from "../../components/navbar/navbar";

import "./consultant.less";

import { getContactWorker } from "../../utils/Interface";

export default class Consultant extends Component<any, any> {
  constructor(props) {
    super(props);
    this.state = {
      name: "consultant",
      pictureUrl: "",
    };
  }

  async onLoad() {
    this.initData();
  }
  componentDidMount() {}

  componentWillUnmount() {}

  componentDidShow() {}

  componentDidHide() {}

  async initData() {
    let res = await getContactWorker();
    console.log("initData", res);
    if (res.data.code === 200) {
      this.setState({ pictureUrl: res.data.data.pictureUrl });
    }
  }

  render() {
    const { pictureUrl } = this.state;
    return (
      <Block>
        <Navbar titleSlot="联系客服" isBack={true} />
        <View className="img">
          <Image
            src={pictureUrl}
            show-menu-by-longpress
            // mode="widthFix"
            mode="aspectFill"
          ></Image>
        </View>
      </Block>
    );
  }
}
