import { Button } from "@taroify/core";
import "./index.less";
import { View, Image } from "@tarojs/components";
import Taro from "@tarojs/taro";
import icon13 from "@/assets/icon/icon13.png";
export default function () {
  const params = Taro.getCurrentInstance().router?.params;

  const sourceType = params?.sourceType;

  let title = "";
  let subTitle = "";
  /** 来源为 审批 */
  if (sourceType === "approve") {
    title = "申请成功";
  }

  /** 来源为上报 */
  if (sourceType === "report") {
    title = "提交成功";
    subTitle = "感谢您的问题";
  }

  return (
    <View className="success_container">
      <View className="content">
        <Image src={icon13} className="successImg"></Image>
        <View>{title}</View>
        <View>{subTitle}</View>

        <Button
          shape="round"
          onClick={() => {
            Taro.reLaunch({ url: "/pages/Index/index" });
          }}
          block
          className="btn"
          color="primary"
        >
          返回首页
        </Button>
      </View>
    </View>
  );
}
