<script lang="ts" setup>
import HighSchoolDetailHeader from './components/HighSchoolDetailHeader.vue'
import { systemInfo } from '@/utils/systemInfo'
import SchoolIntroduce from './components/SchoolIntroduce.vue'
import { getSchoolInfo } from '@/service'

// #ifdef MP-WEIXIN
definePage({
  style: {
    navigationStyle: 'custom',
  },
  excludeLoginPath: true,
})
// #endif

// #ifndef MP-WEIXIN
definePage({
  style: {
    navigationStyle: 'custom',
    transparentTitle: 'always',
    navigationBarTitleText: ''
  },
  excludeLoginPath: true,
})
// #endif

const handleBack = () => {
  uni.navigateBack({ delta: 1 })
}


const tabs = [{ name: '院校简介' },]
const activeIndex = ref(0)
const handleChange = (val: number) => {
  activeIndex.value = val
}

const schoolDetail = ref({})

onLoad((options) => {
  if(options?.id){
    getSchoolInfo({query:{id:options.id}}).then(resp => {
      if(resp.code == 200){
        schoolDetail.value = resp.result
      }
    })
  }else{
    uni.showToast({title:"学校ID不存在"})
  }
})
</script>

<template>
  <view class="gradient-custom pb-safe">
    <sar-navbar title="学校详情" :show-back="true" @back="handleBack"
      :root-style="{ '--sar-navbar-bg': `rgba(255, 255, 255, 0)`, 'padding-top': `${systemInfo?.statusBarHeight}px`, '--sar-navbar-item-color': 'black' }">
    </sar-navbar>
    <HighSchoolDetailHeader :schoolDetail="schoolDetail"/>
    <view class="bg-[#f8f8f8] h-[20rpx]"></view>
    <SchoolIntroduce :schoolDetail="schoolDetail" v-if="activeIndex === 0" />
  </view>
</template>

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