<template>
  <!-- 底部AI智能顾问 -->
  <view
    class="pt-[16rpx] px-[32rpx] flex items-center justify-center bg-[#fff] pb-safe sticky bottom-0 z-999"
    @click="toAiAssistant"
    v-if="aiShow"
  >
    <view
      class="rounded-[8rpx] border-[#1580FF] border-[2rpx] border-solid w-full py-[14rpx] flex items-center justify-center"
    >
      <image
        src="https://api.static.ycymedu.com/images/btn-bottom.png"
        class="w-[52rpx] h-[52rpx] mr-[10rpx]"
      ></image>
      <text class="text-[#1580FF] text-[32rpx] font-700">智能AI顾问</text>
    </view>
  </view>
  <view v-else class="pb-safe"></view>
</template>

<script setup lang="ts">
import { sysDictType } from '@/service/index/api'

const aiShow = ref(true)
sysDictType({ id: 619330547859525 }).then((res) => {
  const { code, result } = res

  const { status } = result as { status: number }
  if (code === 200) {
    if (status === 1) {
      aiShow.value = false
    } else {
      aiShow.value = true
    }
  }
})

const props = defineProps({
  pageId: {
    type: Number,
    default: 0,
  },
  pageType: {
    type: Number,
    default: 0,
  },
})

const toAiAssistant = () => {
  uni.navigateTo({
    url: `/aiService-sub/index/index?id=${props.pageId}&type=${props.pageType}`,
  })
}
</script>
