<!--省控线-->
<script setup>
import {ref} from "vue";
import ApiConstant from "@/common/ApiConstant";
import Request from '@/common/request'
import {onMounted} from "vue";
import StaticConstant from "@/common/StaticConstant";
import View from "../../component/view/view.vue";

let request = new Request()
const dataList = ref()
const userScoreInfo = ref()
const scoreUpdate = ref()
function getHistoryList() {
  let that = this
  let scoreInfo = uni.getStorageSync('scoreInfo')
  userScoreInfo.value = scoreInfo
  let data = {
    professionalCategory: '美术与设计类',
    category: '文科'
  }
  console.log(userScoreInfo.value)

  if (scoreInfo && scoreInfo.professionalCategory) {
    data.professionalCategory = scoreInfo.professionalCategory
  }
  if (scoreInfo && scoreInfo.cognitioPolyclinic) {
    data.category = scoreInfo.cognitioPolyclinic
  }

  //获取 24艺考改革专业分调整
  let scoreUpdater = StaticConstant.professionalCategoryScoreUpdadtes[data.professionalCategory]
  if (scoreUpdater && scoreUpdater.scoreMax) {
    scoreUpdate.value = {...scoreUpdater,professionalCategory:data.professionalCategory}
  }

  request.get(ApiConstant.Score.historyScoreControlLineListGroupYear, data).then(r => {
    if (r.success) {
      let data2 = r.result
      let list = []
      let dataKeys = Object.keys(data2)
      dataKeys.sort(function (a, b) {
        return b - a;
      });
      for (let i = 0; i < dataKeys.length; i++) {
        list.push({year: dataKeys[i], list: data2[dataKeys[i]]})
      }
      dataList.value = list
    }
  }).catch(err => {
  }).finally(() => {
  });
}

onMounted(() => {
  getHistoryList()
})

</script>

<template>
  <view style="background-color: white">
    <view class="container" style="background-color: #ffffcb">
      <text class="uni-h6" v-if="scoreUpdate && scoreUpdate.scoreMax">2024艺考改革，原专业满分{{scoreUpdate.oldScoreMax}}分调整为{{scoreUpdate.scoreMax}}分。</text>
    </view>
    <view class="container font-weight-600" style="" v-if="userScoreInfo"><!--font-family: 'Microsoft YaHei UI Light'-->
      <text class="margin-right-10" style="color: #f9765b">河南省</text>
      <text class="margin-right-10">{{userScoreInfo.professionalCategory}}</text>
      <text>{{userScoreInfo.cognitioPolyclinic}}历年批次线</text>
    </view>
    <view class="" style="padding: 10rpx 30rpx">
      <view v-for="(item,index) in dataList" :key="index">
        <view class="flexWrap">
          <view class="flex-item-10" style="text-align: center">
            <text class="font-weight-600 font-size-medium2" :class="index===0?'':'old-color'" style="line-height: 80rpx">{{item.year}}</text>
          </view>
        </view>
        <view class="flexWrap">
          <view class="flex-item-10" style="margin-bottom: 50rpx">
            <view class="padding20" style="background-color: #f9f9fb;border-radius: 30rpx">
              <view class="tableHead flexWrap border-bottom" style="line-height: 50rpx;">
                <view class="th flex-item-33">
                  <text>批次</text>
                </view>
                <view class="th flex-item-33">
                  <text v-if="userScoreInfo && userScoreInfo.professionalCategory ==='体育类'">
                    {{userScoreInfo.cognitioPolyclinic ==='文科'?'专业(文/理)':'专业(理/文)'}}
                  </text>
                  <text v-else>专业(统/校)</text>
                </view>
                <view class="th flex-item-33">
                  <text v-if="userScoreInfo && userScoreInfo.professionalCategory ==='体育类'">
                    {{userScoreInfo.cognitioPolyclinic ==='文科'?'文化(文/理)':'文化(理/文)'}}
                  </text>
                  <text v-else>文化(统/校)</text>
                </view>
              </view>
              <view class="tableData flexWrap font-weight-b margin-top-20">
                <view class="tr flexWrap" v-for="(it,i) in dataList[index].list" :key="i" :class="index===0?'':'old-color'">
                  <view class="td">
                    <text>{{ it.batch || '-' }}</text>
                  </view>
                  <view class="td">
                    <text>{{ it.specialScore || '-' }}</text>
                    <text v-if="it.specialScoreXk">/{{ it.specialScoreXk || '-' }}</text>
                  </view>
                  <view class="td">
                    <text>{{ it.culturalScore || '-' }}</text>
                    <text v-if="it.culturalScoreXk">/{{ it.culturalScoreXk || '-' }}</text>
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>

    </view>
  </view>
</template>

<style scoped lang="scss">
.container {
  line-height: 80rpx;
  padding: 0 30rpx;
  font-weight: 550;
}


.th{
  text-align: center;
}

.tableHead{
  color: #666478;
  font-size: 25rpx;
}

.tableData{
  //height: 300rpx;
  .tr{
    text-align: center;
    font-size: 26rpx;
    width: 100%;
    height: 100rpx;
    .td{
      width: 33.3%;
      line-height: 100rpx;
    }
  }
}

.old-color{
  color: #666478;
}

.content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: white;
}


.left {
  color: #f36646;
  //color:#eae7ff;
  border-radius: 5rpx;
  margin: 10rpx 0;
}

.right {
  //background-color: #f5c4b8;
  background-color: #f9f9f9;
  color: #41464e;
  font-weight: 550;
  margin: 10rpx 5rpx;
  height: 90rpx;
  line-height: 90rpx;
}
.lineOned{
  background-color: #d68e7e;
}
.lineTwod{
  background-color: #f5c4b8;
}
</style>
