<template>
  <div class="survey-questionnaire w-vw-24">
    <div class="bg-white border-box border-ff overflow-hidden rounded-20">
      <div class="border-box flex flex-items-center flex-justify-between bg-theme-color-50">
        <span class="font-size-18 font-500 color-171717 text-left ml-12">
          调查问卷
        </span>
        <img class="w-102 h-72" :src="surveyData.logoUrl" mode="widthFix" />
      </div>

      <img class="w-full" :src="surveyData.bannerUrl" mode="widthFix" />

      <div class="h-44 m-12 rounded-50 bg-button color-white flex flex-items-center flex-justify-center"
        @click="handleCall">
        前往填写
      </div>
    </div>
  </div>
</template>

<script setup>
import { getAccessToken } from "@/constants/token";
import { defineProps, computed } from "vue";
// import { navigateTo } from "../../router";

const props = defineProps({
  toolCall: {
    type: Object,
    default: {},
  },
});

const surveyData = computed(() => {
  if (props.toolCall?.data) {
    return JSON.parse(props.toolCall?.data);
  } else {
    return {};
  }
});

const handleCall = () => {
  const token = getAccessToken();
  router.push({
    path: surveyData.value.jumpUrl,
    query: {
      token: token,
    },
  });
};
</script>

<style lang="scss" scoped></style>
