<script>
import StaticConstant from "@/common/StaticConstant";
import ApiConstant from "@/common/ApiConstant";
import Request from '@/common/request';
import ImagesConstant from "@/common/ImagesConstant";
import { arrayIsNotEmpty, stringIsNotEmpty } from "@/common/util";
import vip from "../vip/index.vue";

const app = getApp()

let request = new Request()
// 缓存每页最多
const MAX_CACHE_DATA = 100;
// 缓存页签数量
const MAX_CACHE_PAGE = 3;

export default {
  name: "模拟填报",
  computed: {
    app() {
      return app
    },
    vip() {
      return vip
    },
    StaticConstant() {
      return StaticConstant
    },
    ImagesConstant() {
      return ImagesConstant
    }
  },
  data() {
    return {
      ///
      num: { kcj: 0, jwt: 0, nlq: 0, kbd: 0, },
      circle: { kcj: 0, jwt: 0, nlq: 0, kbd: 0, },//百分比
      modelVale: 0,
      topFlag: false,//显示回到顶部
      popupData:{
        text: '',
      },
      otherMajor: {
        visible: false,
        status: 'noMore',
        schoolName: '',
        nowMajor: [],
        list: [],
      },//其他专业数据
      selectForm: {
        province: '',
        schoolName: '',
        paneName: '全部',
        batch: '提前批',
        kslx: '统考',
        rulesEnrollProbabilityList: [],//录取方式
        rulesEnrollProbability: '',
        kyjxList: [],//科研教学
        tagsList: [],//院校标签
        addressList: [],//地区
        schoolNatureList: [],//办学类型
      },
      userInfo: {},
      vipInfo: {},
      scoreInfo: {
        province: null,//省份
        cognitioPolyclinic: null,//科类
        professionalCategory: null,//报考方向
        culturalScore: null,//文化分
        professionalScore: null,//统考分
      },
      /*筛选项 参数 start*/
      defaultSelected: [],
      menuList: [],
      /*筛选项 参数 end*/
      tabIndex: 0,
      tabIndex2: 1,
      scrollInto: "",
      newsList: [],
      cacheTab: [],
      tabBars: [],
      recommendVolunteerList: [],//推荐志愿列表
      page: {
        current: 1,
        pageSize: 5,
        total: 0,
      },//分页结果
      filledVolunteer: {
        visible: false,
        status: 'noMore',

        volunteerId: '',
        volunteerName: '',
        volunteerEarlyAdmissionList: [],//本科提前批
        volunteerUndergraduateAList: [],//本科A段
        volunteerUndergraduateBList: [],//本科B段
        volunteerJuniorCollegeList: [],//高职高专
        volunteerUndergraduateList: [],//体育本科
        volunteerMap: new Map()
      },//已填志愿信息
      currentEduLevel: '本科', // 当前学历层次
      //
      status: 'more',
      statusTypes: StaticConstant.loadStatusTypes,
      contentText: StaticConstant.loadContentText,
    }
  },
  onShow(e) {
    this.userInfo = uni.getStorageSync('userInfo')
  },
  onLoad(e) {
    this.menuList = StaticConstant.fillVolunteerMenuData
    this.vipInfo = uni.getStorageSync('vipInfo')
    if (e.batch && e.volunteerId) {
      //从我的志愿 点击跳转而来
      this.selectForm.batch = e.batch;
      this.filledVolunteer.volunteerId = e.volunteerId;
    }
    // 判断是否带着录取方式进入页面的
    this.selectForm.rulesEnrollProbabilityList = e.rulesEnrollProbability ? [e.rulesEnrollProbability] : []
    //遍历筛选菜单，回显高亮录取方式
    for (let i = 0; i < this.menuList.length; i++) {
      if (this.menuList[i].title === '筛选') {
        for (let j = 0; j < this.menuList[i].children.length; j++) {
          if (this.menuList[i].children[j].title === '录取方式') {
            this.menuList[i].children[j].value = this.selectForm.rulesEnrollProbabilityList
            break
          }
        }
      }
    }

    setTimeout(() => {
      this.tabBars.forEach((tabBar) => {
        this.newsList.push({
          data: [],
          isLoading: false,
          refreshText: "",
          loadingText: '加载更多...'
        });
      });
    }, 350)
    this.clearData()
    this.artVolunteerDetail()
    this.loadMenu()
  },
  // 当翻滚到底部时
  onReachBottom() {
    if (this.vipInfo && this.vipInfo.vipLevel >= 2) {
      this.loadMore()
    }
  },
  onShareAppMessage() {
    return {
      title: '测一测你能上的大学', //分享标题
      path: "/pages/zyb/fillVolunteer/index"
    }
  },
  // 分享到微信朋友圈
  onShareTimeline(res) {
    return {
      title: '测一测你能上的大学', //分享标题
      path: "/pages/zyb/fillVolunteer/index"
    }
  },
  methods: {
    onConfirm(e) {
      if (e.type === 'filter') {
        if (e.children) {
          for (let i = 0; i < e.children.length; i++) {
            if (e.children[i].title === '科研教学') {
              this.selectForm.kyjxList = e.children[i].value
              if (this.selectForm.kyjxList === null) {
                this.selectForm.kyjxList = []
              }
            } else if (e.children[i].title === '录取方式') {
              this.selectForm.rulesEnrollProbabilityList = e.children[i].value
              if (this.selectForm.rulesEnrollProbabilityList === null) {
                this.selectForm.rulesEnrollProbabilityList = []
              }
            } else if (e.children[i].title === '院校标签') {
              this.selectForm.tagsList = e.children[i].value
              if (this.selectForm.tagsList === null) {
                this.selectForm.tagsList = []
              }
            } else if (e.children[i].title === '办学类型') {
              this.selectForm.schoolNatureList = e.children[i].value
              if (this.selectForm.schoolNatureList === null) {
                this.selectForm.schoolNatureList = []
              }
            } else if (e.children[i].title === '地区') {
              this.selectForm.addressList = e.children[i].value
            }
          }
        }
      }
      this.clearData()
      this.getHaveMajorBatchList()
    },
    onChange(e, index) {
      console.log('onChange')
      console.log(e, index)
    },
    loadMore() {
      if (this.status === 'noMore') {
        return;
      }
      console.log('加载中')
      this.page.current++;
      this.getRecommendVolunteerList()
    },
    loadMenu() {
      //加载筛选项
      request.get(ApiConstant.Major.rulesEnrollrobabilityMenuList, {
        professionalCategory: this.scoreInfo.professionalCategory
      }, { showLoading: false }).then(r => {
        if (r.success) {
          this.menuList[2].children[0].options = [...r.result]
        }
      }).catch(err => {
      }).finally(() => {

      });

    },
    search() {
      this.checkVip();
      this.recommendVolunteerList = []
      this.selectForm.paneName = '全部'
      this.page.current = 1
      this.getHaveMajorBatchList()
    },
    goto(url) {
      uni.navigateTo({
        url: url
      })
    },
    topBack() {
      uni.pageScrollTo({
        scrollTop: 0,   // 滚动到页面的目标位置  这个是滚动到顶部, 0
        duration: 300  // 滚动动画的时长
      })
    },
    //一级tab
    ontabtap(e) {
      //切换了 tabs
      console.log(e)
      let index = e.target.dataset.current || e.currentTarget.dataset.current;
      //判断 是否重复切换
      if (index === this.tabIndex) {
        return;
      }
      //判断选择的是本科批还是其他的
      //如果选的本科提前批（校考）
      if (this.tabBars[index].id === '校考') {
        this.selectForm.kslx = '校考'
        this.selectForm.batch = ''
      } else {
        this.selectForm.kslx = '统考'
        this.selectForm.batch = this.tabBars[index].id
        if (this.selectForm.batch === '本科' && this.scoreInfo.professionalCategory !== '体育类') {
          //如果是艺术类，选择的本科，那就选择到本科下的985/211提前批
          this.selectForm.batch = '本科A段'
          this.tabIndex2 = 1
        }
        this.selectForm.paneName = '全部'
      }
      //清除页数
      this.clearData()
      this.getRecommendVolunteerList()
      this.switchTab(index);
    },
    //二级tab
    ontabtap2(e) {
      console.log(e)
      let index = e.target.dataset.current || e.currentTarget.dataset.current;
      //判断 是否重复切换
      if (index === this.tabIndex2) {
        return;
      }
      this.selectForm.batch = this.tabBars[this.tabIndex].childrenTabBars[index].id
      this.selectForm.paneName = '全部'
      //清除页数
      this.clearData()
      this.getRecommendVolunteerList()
      this.tabIndex2 = index;
      //this.switchTab(index);
    },
    switchTab(index) {
      // if (this.newsList[index].data.length === 0) {
      //   //this.getList(index);
      // }
      if (this.tabIndex === index) {
        return;
      }

      // 缓存 tabId
      if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
        let isExist = this.cacheTab.indexOf(this.tabIndex);
        if (isExist < 0) {
          this.cacheTab.push(this.tabIndex);
        }
      }

      this.tabIndex = index;
      this.scrollInto = this.tabBars[index].id;

      // 释放 tabId
      if (this.cacheTab.length > MAX_CACHE_PAGE) {
        let cacheIndex = this.cacheTab[0];
        this.clearTabData(cacheIndex);
        this.cacheTab.splice(0, 1);
      }
    },
    clearTabData(e) {
      this.newsList[e].data.length = 0;
      this.newsList[e].loadingText = "加载更多...";
    },
    /*添加志愿项*/
    addVolunteerItem(item) {
      const that = this;
      const batch = item.batch === '高职高专'? '高职高专' : '本科';
      // 根据item的招生代码、专业代码和学校代码生成唯一的键值
      const itemKey = `${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`;
      // 根据batch的值确定要操作的志愿列表，高职高专对应volunteerJuniorCollegeList，本科对应volunteerUndergraduateList
      const volunteerList = batch === '高职高专'? this.filledVolunteer.volunteerJuniorCollegeList : this.filledVolunteer.volunteerUndergraduateList;
      if (!this.filledVolunteer.volunteerMap.has(itemKey)) {
        // 如果志愿映射表中不存在该itemKey，则将其添加到志愿映射表中
        this.filledVolunteer.volunteerMap.set(itemKey, item);
        // 将该项添加到对应的志愿列表中
        volunteerList.push({...item, indexs:volunteerList.length+1 });
      }else{
        this.deleteVolunteerItem(item)
      }
      if(true) return
      uni.showModal({
        title: item.volunteerIndexs ? '移除志愿' : '确认志愿',
        content: '[' + item.schoolCode + ']' + item.schoolName + '-' + batch + '-[' + item.enrollmentCode + ']' + item.majorName,
        confirmText: '确定',
        cancelText: '取消',
        success: function (res) {
          if (res.confirm) {
            request.post(ApiConstant.Volunteer.volunteerSave, {
              volunteerId: that.filledVolunteer.volunteerId,
              schoolCode: item.schoolCode,
              majorCode: item.majorCode,
              enrollmentCode: item.enrollmentCode,
              enrollProbability: item.enrollProbability,
              studentConvertedScore: parseFloat(item.studentConvertedScore),
              category: item.category
            }).then(r => {
              if (r.success) {
                if (r.result) {
                  that.filledVolunteer.volunteerId = r.result
                }
                setTimeout(function () {
                  uni.showToast({ title: '添加成功', icon: "none" });
                }, 500)
                that.artVolunteerDetail('load')
                setTimeout(function () {
                  that.getOtherMajorList()
                }, 500)
              } else {
                setTimeout(function () {
                  uni.showToast({ title: r.message, icon: "none" });
                }, 500)
              }
            }).catch(err => {
              uni.showToast({ title: err.message, icon: "none" });
            }).finally(() => {

            });
          }
        }
      });
    },
    /*删除志愿项*/
    deleteVolunteerItem(item) {
      console.log('删除志愿项')
      const batch = item.batch === '高职高专'? '高职高专' : '本科';
      // 根据item的招生代码、专业代码和学校代码生成唯一的键值
      const itemKey = `${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`;
      // 根据batch的值确定要操作的志愿列表，高职高专对应volunteerJuniorCollegeList，本科对应volunteerUndergraduateList
      const volunteerList = batch === '高职高专'? this.filledVolunteer.volunteerJuniorCollegeList : this.filledVolunteer.volunteerUndergraduateList;
      if (this.filledVolunteer.volunteerMap.has(itemKey)) {
        // 如果志愿映射表中已存在该itemKey，则删除该键值对
        this.filledVolunteer.volunteerMap.delete(itemKey);
        // 在对应的志愿列表中查找要删除的项的索引
        const findIndex = volunteerList.findIndex((record) => `${record.enrollmentCode}_${record.majorCode}_${record.schoolCode}` === itemKey);
        // 如果找到了要删除的项（索引不为 -1），则从志愿列表中移除该项
        if (findIndex!== -1) {
            volunteerList.splice(findIndex, 1);
        }
        // 重新给每个志愿项排个序号
        volunteerList.forEach((volunteer, index) => {
            volunteer.indexs = index + 1;
        });
      }
    },
    /*保存志愿表 */
    saveFilledVolunteer(e){
      let that = this
      if(this.filledVolunteer.volunteerMap.size == 0){
        uni.showToast({ title: '请先添加志愿', icon: "none" });
        return;
      }
      console.log(this.filledVolunteer.volunteerMap)
      let calculationMajorIdList = []
      this.filledVolunteer.volunteerMap.forEach((value, key, map) => {
        calculationMajorIdList.push(value.calculationMajorId? value.calculationMajorId : value.id)
      });
      uni.showModal({
        title: '保存志愿表',
        content: '确认保存志愿表吗',
        confirmText: '确定',
        cancelText: '取消',
        success: function (res) {
          if (res.confirm) {
            request.post(ApiConstant.Volunteer.saveFilledVolunteer, {
              volunteerId: that.filledVolunteer.volunteerId,
              calculationMajorIdList: calculationMajorIdList
            }).then(r => {
              if (r.success) {
                that.artVolunteerDetail('load')
                setTimeout(function () {
                  that.getOtherMajorList()
                }, 500)
                setTimeout(function () {
                  uni.showToast({ title: '添加成功', icon: "none" });
                }, 500)
              } else {
                setTimeout(function () {
                  uni.showToast({ title: r.message, icon: "none" });
                }, 500)
              }
            }).catch(err => {
              uni.showToast({ title: err.message, icon: "none" });
            }).finally(() => {

            });
          }
        }
      });
    },
    /*获取用户分数*/
    artVolunteerDetail(e) {
      this.scoreInfo = uni.getStorageSync('scoreInfo')
      if (this.scoreInfo.batch) {
        this.selectForm.batch = this.scoreInfo.batch
        //======目前所有批次的专业都可以看到 start
        if (this.scoreInfo.professionalCategory === '体育类') {
          this.tabBars = [{ name: '本科', id: '本科' }, { name: '高职高专', id: '高职高专' }]
        } else {
          this.tabBars = [{ name: '本科提前批', id: '校考' },
          {
            name: '本科批', id: '本科', childrenTabBars: [
              { name: '985/211/双一流', id: '提前批' },
              { name: '公办本科', id: '本科A段' }, { name: '民办本科', id: '本科B段' }
            ]
          }, { name: '高职高专', id: '高职高专' }]
        }
        //======目前所有批次的专业都可以看到 end
        //====================调整默认选中的导航栏 start
        if (this.scoreInfo.professionalCategory === '体育类') {
          if (this.scoreInfo.batch === '本科') {
            this.tabIndex = 0;
          } else {
            this.tabIndex = 1;
          }
        } else {
          if (this.scoreInfo.batch === '本科A段' || this.scoreInfo.batch === '本科B段') {
            this.selectForm.batch = this.scoreInfo.batch
            if (this.scoreInfo.batch === '本科B段') {
              this.tabIndex2 = 2
            }
            this.tabIndex = 1;
          } else if (this.scoreInfo.batch === '高职高专' && this.scoreInfo.professionalCategory !== '体育类') {
            this.tabIndex = 2;
          }
          else {
            for (let i = 0; i < this.tabBars.length; i++) {
              if (this.tabBars[i].id === this.selectForm.batch) {
                //选中
                this.tabIndex = i;
                break;
              }
            }
          }
        }
        //=====================调整默认选中的导航栏 end
      }
      request.get(ApiConstant.Volunteer.artVolunteerDetail, { id: this.filledVolunteer.volunteerId }).then(res => {
        if (res.success) {
          let dataResult = res.result
          //有数据情况下
          const volunteerMap = new Map();
          if (dataResult != null) {
            // 分数信息
            ///this.scoreInfo = res.result.userScoreInfo
            // 处理 已填志愿信息
            this.filledVolunteer.volunteerId = dataResult.id
            this.filledVolunteer.volunteerName = dataResult.volunteerName
            if (true) {
              let key = ''
              let indexs = 1
              //==================================本科 start
              let volunteerUndergraduateList = dataResult.volunteerRecordUndergraduateList;
              for (let i = 0; i < volunteerUndergraduateList.length; i++) {
                key = volunteerUndergraduateList[i].enrollmentCode + "_" + volunteerUndergraduateList[i].majorCode + "_" + volunteerUndergraduateList[i].schoolCode
                volunteerMap.set(key, volunteerUndergraduateList[i])
              }
              indexs = 1;
              let volunteerUndergraduateList2 = [];
              let record = {}
              for (let i = 0; i < volunteerUndergraduateList.length; i++) {
                record = volunteerUndergraduateList[i]
                record.actives = true
                volunteerUndergraduateList2.push(record)
              }
              this.filledVolunteer.volunteerUndergraduateList = volunteerUndergraduateList2

              //==================================本科 end
              //==================================高职高专 start
              let volunteerJuniorCollegeList = dataResult.volunteerRecordJuniorCollegeList;
              for (let i = 0; i < volunteerJuniorCollegeList.length; i++) {
                key = volunteerJuniorCollegeList[i].enrollmentCode + "_" + volunteerJuniorCollegeList[i].majorCode + "_" + volunteerJuniorCollegeList[i].schoolCode
                volunteerMap.set(key, volunteerJuniorCollegeList[i])
              }
              let volunteerJuniorCollegeList2 = [];
              for (let i = 0; i < volunteerJuniorCollegeList.length; i++) {
                record = volunteerJuniorCollegeList[i]
                record.actives = true
                volunteerJuniorCollegeList2.push(record)
              }
              this.filledVolunteer.volunteerJuniorCollegeList = volunteerJuniorCollegeList2
            }
            //==================================高职高专 end
          } else {
            this.filledVolunteer.volunteerJuniorCollegeList = []
            this.filledVolunteer.volunteerUndergraduateList = []
            this.filledVolunteer.volunteerList = []
          }
          this.filledVolunteer.volunteerMap = volunteerMap
        }
      }).catch(err => {
      }).finally(() => {
        if (e && e === 'load') {
          this.laodRecommendVolunterList()
        } else {
          this.getHaveMajorBatchList()
          //this.getRecommendVolunteerList()
        }
      });
    },
    //刷新推荐的志愿列表的志愿填报状态
    laodRecommendVolunterList() {
      //判断专业是否已经填报过
      if (this.filledVolunteer.volunteerMap) {
        let key = ''
        let volunteer = {}
        let recommendVolunteerList = this.recommendVolunteerList
        if (recommendVolunteerList) {
          for (let i = 0; i < recommendVolunteerList.length; i++) {
            key = recommendVolunteerList[i].enrollmentCode + "_" + recommendVolunteerList[i].majorCode + "_" + recommendVolunteerList[i].schoolCode
            volunteer = this.filledVolunteer.volunteerMap.get(key)
            if (volunteer != null) {
              //这个专业已填过
              recommendVolunteerList[i].volunteerIndexs = volunteer.indexs
            } else {
              recommendVolunteerList[i].volunteerIndexs = ''
            }
          }
          this.recommendVolunteerList = recommendVolunteerList
        }
      }
    },
    getHaveMajorBatchList() {
      let kyjxStrs = ''
      if (this.selectForm.kyjxList && this.selectForm.kyjxList.length > 0) {
        kyjxStrs = this.selectForm.kyjxList.join(',')
      }
      let tagsStrs = ''
      if (this.selectForm.tagsList && this.selectForm.tagsList.length > 0) {
        tagsStrs = this.selectForm.tagsList.join(",")
      }
      let schoolNatureStrs = ''
      if (this.selectForm.schoolNatureList && this.selectForm.schoolNatureList.length > 0) {
        schoolNatureStrs = this.selectForm.schoolNatureList.join(",")
      }
      //地区
      let province = ''
      if (arrayIsNotEmpty(this.selectForm.addressList)) {
        province = this.selectForm.addressList.join(",")
      }
      //录取方式
      let rulesEnrollProbability = ''
      if (arrayIsNotEmpty(this.selectForm.rulesEnrollProbabilityList)) {
        rulesEnrollProbability = this.selectForm.rulesEnrollProbabilityList.join(",")
      }
      let params = {
        schoolName: this.selectForm.schoolName,//学校名称
        province: province,
        rulesEnrollProbability: rulesEnrollProbability,
        tagsStrs: tagsStrs,
        schoolNatureStrs: schoolNatureStrs,
        kyjxStrs: kyjxStrs,
        scoreId: this.scoreInfo.id,
        kslx: this.selectForm.kslx
      }
      request.get(ApiConstant.Major.groupByBatchNumber, params).then(res => {
        if (res.success) {
          let haveMajorList = res.result
          if (arrayIsNotEmpty(haveMajorList)) {
            if (haveMajorList.includes('提前批')) {
              this.tabIndex = 1
              this.tabIndex2 = 0
              this.selectForm.batch = '提前批'
            } else if (haveMajorList.includes('本科A段')) {
              this.tabIndex = 1
              this.tabIndex2 = 1
              this.selectForm.batch = '本科A段'
            } else if (haveMajorList.includes('本科B段')) {
              this.tabIndex = 1
              this.tabIndex2 = 2
              this.selectForm.batch = '本科B段'
            } else if (haveMajorList.includes('本科批') || haveMajorList.includes('本科')) {
              this.tabIndex = 0
              this.selectForm.batch = '本科'
            } else if (haveMajorList.includes('高职高专')) {
              if (this.scoreInfo.professionalCategory === '体育类') {
                this.tabIndex = 1
              } else {
                this.tabIndex = 2
              }
              this.selectForm.batch = '高职高专'
            }
          }
          console.log(result.haveMajorList)
        }
      }).catch(err => {
      }).finally(() => {
        this.getRecommendVolunteerList()
      });
    },
    //获取推荐志愿列表
    getRecommendVolunteerList() {
      this.status = 'loading'
      let kyjxStrs = ''
      if (this.selectForm.kyjxList && this.selectForm.kyjxList.length > 0) {
        kyjxStrs = this.selectForm.kyjxList.join(',')
      }
      let tagsStrs = ''
      if (this.selectForm.tagsList && this.selectForm.tagsList.length > 0) {
        tagsStrs = this.selectForm.tagsList.join(",")
      }

      let schoolNatureStrs = ''
      if (this.selectForm.schoolNatureList && this.selectForm.schoolNatureList.length > 0) {
        schoolNatureStrs = this.selectForm.schoolNatureList.join(",")
      }
      //地区
      let province = ''
      if (arrayIsNotEmpty(this.selectForm.addressList)) {
        province = this.selectForm.addressList.join(",")
      }
      //录取方式
      let rulesEnrollProbability = ''
      if (arrayIsNotEmpty(this.selectForm.rulesEnrollProbabilityList)) {
        rulesEnrollProbability = this.selectForm.rulesEnrollProbabilityList.join(",")
      }
      let params = {
        schoolName: this.selectForm.schoolName,//学校名称
        pageNum: this.page.current,
        pageSize: (this.vipInfo && this.vipInfo.vipLevel >= 2) ? this.page.pageSize : 3,
        paneName: this.selectForm.paneName,
        batch: this.selectForm.batch,
        province: province,
        rulesEnrollProbability: rulesEnrollProbability,
        tagsStrs: tagsStrs,
        schoolNatureStrs: schoolNatureStrs,
        kyjxStrs: kyjxStrs,
        scoreId: this.scoreInfo.id,
        kslx: this.selectForm.kslx
      }
      request.get(ApiConstant.Major.recommendMajorPage, params).then(res => {
        if (res.success) {
          let result = res.result
          let allNumber = result.allNumber
          this.circle.kcj = this.toPercent(result.kcj, allNumber)//可冲击
          this.circle.jwt = this.toPercent(result.jwt, allNumber)//较稳妥
          this.circle.nlq = this.toPercent(result.nan, allNumber)//难录取
          this.circle.kbd = this.toPercent(result.kbd, allNumber)//可保底
          this.num.kcj = result.kcj//可冲击
          this.num.jwt = result.jwt//较稳妥
          this.num.nlq = result.nan//难录取
          this.num.kbd = result.kbd//可保底
          let records = result.pageList.records
          //判断专业是否已经填报过
          if (this.filledVolunteer.volunteerMap) {
            let key = ''
            let volunteer = {}
            if (result && records) {
              for (let i = 0; i < records.length; i++) {
                key = records[i].enrollmentCode + "_" + records[i].majorCode + "_" + records[i].schoolCode
                volunteer = this.filledVolunteer.volunteerMap.get(key)
                if (volunteer != null) {
                  //这个专业已填过
                  records[i].volunteerIndexs = volunteer.indexs
                } else {
                  records[i].volunteerIndexs = ''
                }
              }
            }
          }

          this.recommendVolunteerList = [...this.recommendVolunteerList, ...records]
          if (result.pageList.current >= result.pageList.pages) {
            this.status = 'noMore'
          } else {
            this.status = 'more'
          }

          //修改分页参数
          this.page.total = result.pageList.total
          this.page.current = result.pageList.current

        }
      }).catch(err => {
      }).finally(() => {
      });
    },
    //计算百分比
    toPercent(num, total) {
      return (Math.round(num / total * 10000) / 100.00);// 小数点后两位百分比
    },
    clearInput() {
      this.selectForm.schoolName = ''
    },
    switchPane(e) {
      if (this.selectForm.paneName !== e && (this.vipInfo && this.vipInfo.vipLevel >= 2)) {
        this.selectForm.paneName = e
      } else {
        this.selectForm.paneName = '全部'
      }
      this.clearData()
      this.getRecommendVolunteerList()
    },
    clearData() {
      this.recommendVolunteerList = []
      this.page.current = 1
    },
    checkBao(e) {
      if (e >= 93) {
        return ImagesConstant.bao.kebaodi;
      } else if (e < 93 && e >= 74) {
        return ImagesConstant.bao.jiaowentuo;
      } else if (e < 74 && e >= 60) {
        return ImagesConstant.bao.kechongji;
      }
      return ImagesConstant.bao.nanluqu;
    },
    //格式化录取概率
    formatDecimal(e) {
      try {
        if (e <= 0) {
          return '无概率'
        }
        return parseFloat(e).toFixed(2) + '%';
      } catch (error) {
        return '??';
      }
    },
    checkColorText(e) {
      if (this.vipInfo && this.vipInfo.vipLevel < 2) {
        return '#868686';
      } else if (e >= 93) {
        return '#3e8e43';
      } else if (e < 93 && e >= 74) {
        return '#4975fd';
      } else if (e < 74 && e >= 60) {
        return '#F8880E';
      }
      return '#c83428';
    },
    clickTop() { //回到顶部
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 300
      });
    },

    getOtherMajorList() {
      this.otherMajor.list = []
      let e = this.otherMajor.nowMajor
      //判断当前第一个专业是否已选中
      if (this.filledVolunteer.volunteerMap) {
        let key = ''
        let volunteer = {}
        if (e) {
          key = e.enrollmentCode + "_" + e.majorCode + "_" + e.schoolCode
          volunteer = this.filledVolunteer.volunteerMap.get(key)
          if (volunteer) {
            this.otherMajor.nowMajor.volunteerIndexs = volunteer.indexs
          } else {
            this.otherMajor.nowMajor.volunteerIndexs = ''
          }
        }
      }

      //组装查询参数
      let params = {
        schoolCode: e.schoolCode,
        batch: e.batch,
        pageSize: this.vipInfo && this.vipInfo.vipLevel >= 2 ? 99 : 3,
        professionalCategory: this.scoreInfo.professionalCategory,
        cognitioPolyclinic: this.scoreInfo.cognitioPolyclinic
      }
      //当前选中的专业 key
      let eKey = e.enrollmentCode + "_" + e.majorCode + "_" + e.schoolCode
      this.otherMajor.status = 'loading'
      request.get(ApiConstant.Major.recommendSchoolOtherMajor, params, { showLoad: false }).then(res => {
        console.log('返回值')
        console.log(res)
        if (res.success && res.result) {
          let records = res.result.list
          //判断专业是否已经填报过
          if (this.filledVolunteer.volunteerMap) {
            let key = ''
            let volunteer = {}
            let list = []
            if (records) {
              for (let i = 0; i < records.length; i++) {
                key = records[i].enrollmentCode + "_" + records[i].majorCode + "_" + records[i].schoolCode
                if (eKey === key) {
                  continue
                }
                volunteer = this.filledVolunteer.volunteerMap.get(key)
                if (volunteer != null) {
                  //这个专业已填过
                  records[i].volunteerIndexs = volunteer.indexs
                } else {
                  records[i].volunteerIndexs = ''
                }
                list.push(records[i])
              }
            }
            this.otherMajor.list = [...this.otherMajor.list, ...list]
          }
        }
      }).catch(err => {
      }).finally(() => {
        this.otherMajor.status = 'noMore'
      });
    },
    onFillVolunteerOpen(e) {
      console.log(this.filledVolunteer);
      this.filledVolunteer.visible = true
    },
    onFillVolunteerClose() {
      console.log('关闭已填报专业');

      this.filledVolunteer.visible = false
    },
    onFillVolunteerOpen(e) {
      console.log(this.filledVolunteer);
      this.filledVolunteer.visible = true
    },
    // 切换学历层次
    switchEduLevel(level) {
      this.currentEduLevel = level
    },
    showHistoryInfo(history){
      uni.showToast({ title: `录取方式：${history.rulesEnrollProbability|| ''}，\n计算方式：${history.probabilityOperator || ''}`, icon: "none" });
    },
    //打开选择其他专业
    onOtherMajorOpen(e) {
      this.otherMajor.nowMajor = { ...e }
      this.otherMajor.schoolName = e.schoolName
      this.otherMajor.visible = true
      this.getOtherMajorList()
    },
    onOtherMajorClose() {
      this.otherMajor.visible = false
    },
    checkVip() {
      if (!this.vipInfo || !this.vipInfo.vipFlag || this.vipInfo.vipLevel < 2) {
        uni.showModal({
          title: 'VIP专享',
          // 提示文字
          content: '该功能为增值内容，开通会员后即可免费查看！',
          // 取消按钮的文字自定义
          cancelText: "取消",
          // 确认按钮的文字自定义
          confirmText: "开通服务",
          //删除字体的颜色
          confirmColor: 'red',
          //取消字体的颜色
          cancelColor: '#dddddd',
          success: function (res) {
            if (res.confirm) {
              // 执行确认后的操作
              that.goto('/pages/zyb/vip/index')
            }
          }
        })
        return
      }
    }
  },
  onPageScroll(e) { //根据距离顶部距离是否显示回到顶部按钮
    //当距离大于600时显示回到顶部按钮，//当距离小于600时隐藏回到顶部按钮
    this.topFlag = e.scrollTop > 600;
  }
}
</script>

<template>
  <view class="divider" />
  <view class="backcolorwhite">
    <view class="header">
      <view class="search-view">
        <view style="display: flex;height: 100rpx;border-bottom: 1px solid #f5f5f5;">
          <view style="width: 90%">
            <uni-search-bar class="uni-mt-10" radius="100" placeholder="请输入院校" v-model="selectForm.schoolName"
              @clear="clearInput" cancelButton="none" @confirm="search" />
          </view>
          <view style="width: 10%;line-height: 100rpx">
            <text @click="search">搜索</text>
          </view>
        </view>
        <le-dropdown v-model:menuList="menuList" themeColor="#3d76fd" :duration="200" :isCeiling="true"
          @onConfirm="onConfirm" @onChange="onChange"></le-dropdown>
      </view>
    </view>
    <view class="divider" />
    <!--我的成绩 卡片-->
    <view class="uni-flex uni-row">
      <view class="score-card">
        <view class="uni-flex uni-row flex">
          <view class="flex-item-8">
            <text style="font-size: 50rpx">我的成绩</text>
          </view>
          <view class="flex-item-2" @click="goto('/pages/zyb/score/edit?scoreId=' + this.scoreInfo.id)">
            <image :src="ImagesConstant.edit" class="icon50 float-right" style="line-height: 50rpx" />
          </view>
        </view>

        <view class="text-list">
          <text class="t">省份：{{ scoreInfo.province }}</text>
          <text class="t">选科：{{ scoreInfo.cognitioPolyclinic === '文科' ? '历史组' : '物理组' }}</text>
          <text class="t">类别：{{ scoreInfo.professionalCategory }}</text>
        </view>
        <view class="text-list">
          <text class="t">文化成绩：{{ scoreInfo.culturalScore }}</text>
          <text class="t">{{ scoreInfo.professionalCategory === '音乐类' ? '主项成绩' : '统考成绩' }}：{{
            scoreInfo.professionalScore
          }}
          </text>
        </view>
        <view class="text-list" v-if="scoreInfo">
          <text class="t" v-if="scoreInfo.yybysy && scoreInfo.yybysy !== 0">音乐表演声乐：{{ scoreInfo.yybysy }}</text>
          <text class="t" v-if="scoreInfo.yybyqy && scoreInfo.yybyqy !== 0">音乐表演器乐：{{ scoreInfo.yybyqy }}</text>
          <text class="t" v-if="scoreInfo.yyjy && scoreInfo.yyjy !== 0">音乐教育：{{ scoreInfo.yyjy }}</text>
          <text class="t" v-if="scoreInfo.fzby && scoreInfo.fzby !== 0">服装表演：{{ scoreInfo.fzby }}</text>
          <text class="t" v-if="scoreInfo.xjysdy && scoreInfo.xjysdy !== 0">戏剧影视导演：{{ scoreInfo.xjysdy }}</text>
          <text class="t" v-if="scoreInfo.xjysby && scoreInfo.xjysby !== 0">戏剧影视表演：{{ scoreInfo.xjysby }}</text>
        </view>
      </view>
    </view>
    <!--通告栏-->
    <!--    <view style="padding: 0 10rpx">
          <uni-notice-bar show-icon text="有关2024年全国艺考省份政策及数据说明"
                          @click="goto('/pages/zyb/other/web-view?url=https://yitisheng.vip/wxSJIRHyQUBA/zkzc.html')"/>
        </view>-->
    <!--导航栏-->
    <view class="tabs">
      <scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false"
        :scroll-into-view="scrollInto">
        <view v-for="(tab, index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id" :data-current="index"
          @click="ontabtap">
          <text class="uni-tab-item-title" :class="tabIndex === index ? 'uni-tab-item-title-active' : ''">{{ tab.name }}
          </text>
        </view>
      </scroll-view>
      <scroll-view id="tab-bar" class="scroll-h border-top" :scroll-x="true" :show-scrollbar="false"
        :scroll-into-view="scrollInto" v-if="tabBars[tabIndex] && tabBars[tabIndex].childrenTabBars">
        <view v-for="(tab, index) in tabBars[tabIndex].childrenTabBars" :key="tab.id" class="uni-tab-item2" :id="tab.id"
          :data-current="index" @click="ontabtap2">
          <text class="uni-tab-item-title" :class="tabIndex2 === index ? 'uni-tab-item-title-active' : ''">{{ tab.name
            }}
          </text>
        </view>
      </scroll-view>
      <view class="uni-flex uni-row flex border-top" style="padding: 20rpx 0 10rpx 0" v-if="selectForm.kslx === '统考'">
        <view class="flex-item-05"></view>
        <view class="flex-item-2" v-if="num.nlq !== 0" @click="switchPane('难录取')">
          <l-circle v-model:current="modelVale" :percent="(vipInfo && vipInfo.vipLevel >= 2) ? circle.nlq : 0"
            size="130rpx" strokeColor="#c83428">
            <view class="centerTxt">
              <view class="num">
                {{ vipInfo && vipInfo.vipLevel >= 2 ? num.nlq : '??' }}
              </view>
              <view class="txt" :class="selectForm.paneName === '难录取' ? 'red' : ''">难录取</view>
            </view>
          </l-circle>
        </view>
        <view class="flex-item-05" v-if="num.kcj !== 0"></view>
        <view class="flex-item-2" v-if="num.kcj !== 0" @click="switchPane('可冲击')">
          <l-circle v-model:current="modelVale" :percent="(vipInfo && vipInfo.vipLevel >= 2) ? circle.kcj : 0"
            size="130rpx" strokeColor="#F8880E">
            <view class="centerTxt">
              <view class="num">
                {{ vipInfo && vipInfo.vipLevel >= 2 ? num.kcj : '??' }}
              </view>
              <view class="txt" :class="selectForm.paneName === '可冲击' ? 'redOrange2' : ''">可冲击</view>
            </view>
          </l-circle>
        </view>
        <view class="flex-item-05" v-if="num.jwt !== 0"></view>
        <view class="flex-item-2" v-if="num.jwt !== 0" @click="switchPane('较稳妥')">
          <l-circle v-model:current="modelVale" :percent="(vipInfo && vipInfo.vipLevel >= 2) ? circle.jwt : 0"
            size="130rpx" strokeColor="#4975fd">
            <view class="centerTxt">
              <view class="num">
                {{ (vipInfo && vipInfo.vipLevel >= 2) ? num.jwt : '??' }}
              </view>
              <view class="txt" :class="selectForm.paneName === '较稳妥' ? 'blue' : ''">较稳妥</view>
            </view>
          </l-circle>
        </view>
        <view class="flex-item-05" v-if="num.kbd !== 0"></view>
        <view class="flex-item-2" v-if="num.kbd !== 0" @click="switchPane('可保底')">
          <l-circle v-model:current="modelVale" :percent="(vipInfo && vipInfo.vipLevel >= 2) ? circle.kbd : 0"
            size="130rpx" strokeColor="#3e8e43">
            <view class="centerTxt">
              <view class="num">
                {{ (vipInfo && vipInfo.vipLevel >= 2) ? num.kbd : '??' }}
              </view>
              <view class="txt" :class="selectForm.paneName === '可保底' ? 'green' : ''">可保底</view>
            </view>
          </l-circle>
        </view>
        <view class="flex-item-05"></view>
      </view>
    </view>
  </view>
  <page-head title="当前为系统模拟计划，请注意辨别"></page-head>
  <!--推荐列表-->
  <view class="fillVolunteer">
    <view class="volunteerItem radius8" v-for="(item, index) in recommendVolunteerList" :key="index">
      <!--院校信息-->
      <view class="flex" @click="goto('/pages/zyb/school/detail?schoolCode=' + item.schoolCode)">
        <!--院校图片-->
        <view class="flex-item-22">
          <image :src="item.schoolIcon || ImagesConstant.defaultIcon" class="icon128" />
        </view>
        <!--院校代码-->
        <view class="flex-item-77">
          <view class="flex slateGray">
            <text class="flex-item-4">院校代码[{{ item.schoolCode }}]</text>
            <text class="flex-item-25">{{ item.province }}</text>
            <view class="flex-item-35" v-if="selectForm.kslx === '统考'">
              <view style="float: right;line-height: 50rpx;" class="font-weight-600">
                <text class="font-size-mini" :style="'color:' + checkColorText(item.enrollProbability)">
                  {{ vipInfo && vipInfo.vipLevel >= 2 ? formatDecimal(item.enrollProbability) : '??' }}
                </text>
                <image :src="checkBao(item.enrollProbability)" class="icon50" v-if="vipInfo && vipInfo.vipLevel >= 2" />
              </view>
            </view>
          </view>
          <view class="flex">
            <text class="font-size-medium">{{ item.schoolName }}</text>
          </view>
          <view class="flex tags slateGray">
            <text class="tag" v-for="t in item.tagsList" :key="t">
              {{ t }}
            </text>
          </view>
          <view class="flex">
            <view class="flex-item-65 slateGray" style="line-height: 50rpx">
              <text v-if="item.state === '新增'" style="color: red;font-size: 25rpx">新增</text>
              <text class="tag">[{{ item.enrollmentCode }}]{{ item.majorName }}</text>
              <text class="tag">{{ item.tuition }}</text>
              <text v-if="item.limitation">{{ item.majorDetail }}</text>
              <text class="margin-left-10">
                <text class="tag" v-if="item.otherScoreLimitation && item.otherScoreLimitation !== ''">
                  {{ item.otherScoreLimitation }}
                </text>
              </text>
            </view>
            <view class="flex-item-35">
              <view style="float: right;line-height: 50rpx;" class="font-weight-600"
                v-if="vipInfo && (item.privateStudentScore || item.studentConvertedScore) && vipInfo.vipLevel >= 2">
                <text>计算分</text>
                <text class="font-size-mini margin-left-10" :style="'color:' + checkColorText(item.enrollProbability)">
                  {{ item.privateStudentScore || item.studentConvertedScore }}
                </text>
              </view>
              <view style="float: right;line-height: 50rpx;" class="font-weight-600"
                v-show="app.globalData.StaticConstant.remote.showZeSuan">
                <text>折合分</text>
                <text class="font-size-mini margin-left-10" :style="'color:' + checkColorText(item.enrollProbability)">
                  {{ item.studentScore }}
                </text>
              </view>
            </view>
          </view>
        </view>
        <!---->
      </view>
      <!--招录信息-->
      <view class="flex font-size-mini">
        <view class="flex-item-5" style="line-height: 40rpx">
          <view v-for="(history, h) in item.historyMajorEnrollList" :key="h"  @click="showHistoryInfo(history)">
            <text>{{ history.year }}年录取最低分：</text>
            <text class="red">{{ history.admissionLine }}分</text>
          </view>
        </view>
        <view class="flex-item-5" style="line-height: 40rpx">
          <view class="flex" style="float: right">
            <text>{{ app.globalData.StaticConstant.remote.nowYear }}省内计划录取：</text>
            <text v-if="item.planNum" class="green font-weight-600">{{ item.planNum }}人</text>
            <text v-else class="green">暂未发布</text>
          </view>
        </view>
      </view>
      <view class="flex" style="line-height: 50rpx">
        <view class="flex-item-7">
          <text>{{ app.globalData.StaticConstant.remote.nowYear }}录取方式:</text>
          <text v-if="item.rulesEnrollProbability" class="blue">{{ item.rulesEnrollProbability }}</text>
          <text v-else class="blue">暂未发布</text>
        </view>
        <view class="flex-item-3">
          <!-- item.volunteerIndexs -->
          <view :class="filledVolunteer.volunteerMap.has(`${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`) ? 'volunteer-item-active' : ''" class="otherMajorBtn radius8"
            @click="onOtherMajorOpen(item)">
            <text>查看可选专业</text>
          </view>
        </view>
      </view>
    </view>
    <view class="container" @click="loadMore" v-if="userInfo.vipFlag">
      <uni-load-more :status="status" :content-text="contentText" />
    </view>
  </view>
  <!--已填志愿列表 Start-->
  <px-popup-bottom :background="'#ffffff'" :color="'black'" :visible.sync="filledVolunteer.visible" title=""
    maxHeight="1200" radius="40" @close="onFillVolunteerClose">
    <view class="flexWrap" style="height: 50rpx;line-height: 50rpx">
      <view class="flex-item-8">
        <text class="darkGray font-weight-550">已填志愿信息</text>
      </view>
      <view class="flex-item-2">
        <image @click="onFillVolunteerClose" :src="ImagesConstant.close" class="icon32 float-right"
          style="position: relative;top: 5rpx" />
      </view>
    </view>
    <!-- 本科/专科切换标签 -->
    <view class="edu-tabs">
      <view class="edu-tab" :class="{ 'edu-tab-active': currentEduLevel === '本科' }" @click="switchEduLevel('本科')">
        <text>本科</text>
      </view>
      <view class="edu-tab" :class="{ 'edu-tab-active': currentEduLevel === '专科' }" @click="switchEduLevel('专科')">
        <text>专科</text>
      </view>
    </view>
    <!-- 根据学历层次显示对应的志愿列表 -->
    <scroll-view scroll-y="true" style="height: 800rpx;margin: 30rpx 0">
      <view class="filled-volunteer-list">
        <view v-for="(item, index) in currentEduLevel === '本科'? filledVolunteer.volunteerUndergraduateList : filledVolunteer.volunteerJuniorCollegeList" :key="index" class="volunteer-item">
          <view class="flexWrap">
            <view class="flex-item-15 select">
              <view class="selectIndex">
                <text style="line-height: 50rpx">{{ item.indexs }}</text>
              </view>
            </view>
            <view class="flex-item-65" style="height: 60rpx;"
              @click="goto('/pages/zyb/school/detail?schoolCode=' + item.schoolCode)">
              <text>[{{ item.schoolCode }}]{{ item.schoolName }}</text>
            </view>
            <view class="flex-item-20">
              <view class="float-right">
                <image @click="deleteVolunteerItem(item)" src="/static/icons/delete.png"
                  class="icon50 margin-left-50" />
              </view>
            </view>
          </view>
          <view class="flexWrap marginTopBot20">
            <view class="flex-item-15 select"></view>
            <view class="flex-item-85">
              <text class="darkGray">[{{ item.enrollmentCode }}]</text>
              <text class="margin-left-10">{{ item.majorName }}</text>
            </view>
          </view>
        </view>
        <view v-if="filledVolunteer.volunteerUndergraduateList.length === 0" class="no-data">
          <text>暂无志愿</text>
        </view>
      </view>
    </scroll-view>
    <view class="volunteer-item-active" @click="saveFilledVolunteer">
      保存
    </view>
  </px-popup-bottom>
  <!--已填志愿列表 End-->

  <!--其他专业 Start-->
  <px-popup-bottom :background="'#ffffff'" :color="'black'" :visible.sync="otherMajor.visible" title="" maxHeight="1200"
    radius="40" @close="onOtherMajorClose">
    <view class="flexWrap" style="height: 50rpx;line-height: 50rpx">
      <view class="flex-item-8">
        <text class="darkGray font-weight-550">{{ otherMajor.schoolName }}</text>
      </view>
      <view class="flex-item-2">
        <image @click="onOtherMajorClose" :src="ImagesConstant.close" class="icon32 float-right"
          style="position: relative;top: 5rpx" />
      </view>
    </view>
    <view class="fillVolunteer" style="padding: 0">
      <scroll-view scroll-y="true" style="height: 800rpx;margin-top: 30rpx">
        <!--选择的专业-->
        <view class="volunteerItem radius15" style="background-color: #f9f9fb;padding: 20rpx 20rpx"
          v-if="otherMajor.nowMajor">
          <view class="flexWrap" @click="goto('/pages/zyb/school/detail?schoolCode=' + otherMajor.nowMajor.schoolCode)">
            <view class="flex-item-10 flexWrap">
              <view class="flex-item-65 font-weight-b" style="line-height: 50rpx">
                <text class="" style="display: flex;">[{{ otherMajor.nowMajor.enrollmentCode }}]{{
                  otherMajor.nowMajor.majorName }}</text>
                <text class="tag">{{ otherMajor.nowMajor.tuition }}</text>
                <text v-if="otherMajor.nowMajor.majorDetail">{{ otherMajor.nowMajor.majorDetail }}</text>
                <!--                <text v-if="otherMajor.nowMajor.limitation">({{otherMajor.nowMajor.limitation}})</text>-->
                <text class="margin-left-10">
                  <text class="tag"
                    v-if="otherMajor.nowMajor.otherScoreLimitation && otherMajor.nowMajor.otherScoreLimitation !== ''">
                    {{ otherMajor.nowMajor.otherScoreLimitation }}
                  </text>
                </text>
              </view>
              <view class="flex-item-35">
                <view style="float: right;line-height: 50rpx;" class="font-weight-600" v-if="selectForm.kslx === '统考'">
                  <text class="font-size-mini"
                    :style="'color:' + checkColorText(otherMajor.nowMajor.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? formatDecimal(otherMajor.nowMajor.enrollProbability) : '??'
                    }}
                  </text>
                  <image :src="checkBao(otherMajor.nowMajor.enrollProbability)" class="icon50"
                    v-if="(vipInfo && vipInfo.vipLevel >= 2)" />
                </view>
              </view>
            </view>
          </view>
          <!--招录信息-->
          <view class="flex font-size-mini">
            <view class="flex-item-5" style="line-height: 60rpx">
              <view v-for="(history, h) in otherMajor.nowMajor.historyMajorEnrollList" @click="showHistoryInfo(history)" :key="h">
                <text>{{ history.year }}年录取最低分：</text>
                <text class="red">{{ history.admissionLine }}分</text>
              </view>
            </view>
            <view class="flex-item-5" style="line-height: 40rpx">
              <view class="flex" style="float: right" v-show="app.globalData.StaticConstant.remote.showZeSuan">
                <view style="float: right;line-height: 50rpx;" class="font-weight-600">
                  <text>折合分</text>
                  <text class="font-size-mini margin-left-10"
                    :style="'color:' + checkColorText(otherMajor.nowMajor.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? otherMajor.nowMajor.studentScore : '??' }}
                  </text>
                </view>
              </view>
              <view class="flex" style="float: right">
                <text>{{ app.globalData.StaticConstant.remote.nowYear }}省内计划录取：</text>
                <text v-if="otherMajor.nowMajor.planNum" class="green font-weight-600">{{
                  otherMajor.nowMajor.planNum
                }}人
                </text>
                <text v-else class="green">暂未发布</text>
              </view>
            </view>
          </view>
          <view class="flex" style="line-height: 50rpx">
            <view class="flex-item-7">
              <text>{{ app.globalData.StaticConstant.remote.nowYear }}录取方式:</text>
              <text v-if="otherMajor.nowMajor.rulesEnrollProbability" class="blue">
                {{ otherMajor.nowMajor.rulesEnrollProbability }}
              </text>
              <text v-else class="blue">暂未发布</text>
            </view>
            <view class="flex-item-3">
              <!-- v-if="otherMajor.nowMajor.enrollProbability" -->
              <view :class="filledVolunteer.volunteerMap.has(`${otherMajor.nowMajor.enrollmentCode}_${otherMajor.nowMajor.majorCode}_${otherMajor.nowMajor.schoolCode}`) ? 'volunteer-item-active' : ''" class="otherMajorBtn radius8"
                @click="addVolunteerItem(otherMajor.nowMajor)">
                <!-- <image :src="filledVolunteer.volunteerMap.has(`${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`) ? ImagesConstant.duigou_orange : ImagesConstant.add_orange" class="icon32" /> -->
                <text>{{ filledVolunteer.volunteerMap.has(`${otherMajor.nowMajor.enrollmentCode}_${otherMajor.nowMajor.majorCode}_${otherMajor.nowMajor.schoolCode}`) ? '已加入志愿' : '加入志愿表' }}</text>
              </view>
            </view>
          </view>
        </view>
        <view class="border-top marginTopBot20">
          <text class="font-weight-b font-size-mini" style="line-height: 50rpx">*该组其他概率专业</text>
        </view>
        <!--院校下其他的专业-->
        <view class="volunteerItem radius15" style="background-color: #f9f9fb;padding: 20rpx 20rpx"
          v-for="(item, index) in otherMajor.list" :key="index"
          :class="index === otherMajor.list.length ? '' : 'border-bottom'">
          <view class="flexWrap" @click="goto('/pages/zyb/school/detail?schoolCode=' + item.schoolCode)">
            <view class="flex-item-10 flexWrap">
              <view class="flex-item-65 font-weight-b" style="line-height: 50rpx">
                <text class="" style="display: flex;">[{{ item.enrollmentCode }}]{{ item.majorName }}</text>
                <text class="tag">{{ item.tuition }}</text>
                <text v-if="item.majorDetail">{{ item.majorDetail }}</text>
                <!--                <text v-if="item.limitation">({{item.limitation}})</text>-->
                <text class="margin-left-10">
                  <text class="tag" v-if="item.otherScoreLimitation && item.otherScoreLimitation !== ''">
                    {{ item.otherScoreLimitation }}分
                  </text>
                </text>
              </view>
              <view class="flex-item-35">
                <view style="float: right;line-height: 50rpx;" class="font-weight-600" v-if="selectForm.kslx === '统考'">
                  <text class="font-size-mini" :style="'color:' + checkColorText(item.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? formatDecimal(item.enrollProbability) : '??' }}
                  </text>
                  <image :src="checkBao(item.enrollProbability)" class="icon50"
                    v-if="vipInfo && vipInfo.vipLevel >= 2" />
                </view>
              </view>
            </view>
          </view>
          <!--招录信息-->
          <view class="flex font-size-mini">
            <view class="flex-item-5" style="line-height: 40rpx">
              <view v-for="(history, h) in item.historyMajorEnrollList" :key="h">
                <text>{{ history.year }}年录取最低分：</text>
                <text class="red">{{ history.admissionLine }}分</text>
              </view>
            </view>
            <view class="flex-item-5" style="line-height: 40rpx">
              <view class="flex" style="float: right">
                <view style="float: right;line-height: 50rpx;" class="font-weight-600"
                  v-show="app.globalData.StaticConstant.remote.showZeSuan">
                  <!--v-if="item.studentConvertedScore"-->
                  <text>折合分</text>
                  <text class="font-size-mini margin-left-10"
                    :style="'color:' + checkColorText(item.enrollProbability)">
                    {{ vipInfo && vipInfo.vipLevel >= 2 ? item.studentScore : '??' }}
                  </text>
                </view>
              </view>
              <view class="flex" style="float: right">
                <text>{{ app.globalData.StaticConstant.remote.nowYear }}省内计划录取：</text>
                <text v-if="item.planNum" class="green font-weight-600">{{ item.planNum }}人</text>
                <text v-else class="green">暂未发布</text>
              </view>
            </view>
          </view>
          <view class="flex" style="line-height: 50rpx">
            <view class="flex-item-7">
              <text>{{ app.globalData.StaticConstant.remote.nowYear }}录取方式:</text>
              <text v-if="item.rulesEnrollProbability" class="blue">{{ item.rulesEnrollProbability }}</text>
              <text v-else class="blue">暂未发布</text>
            </view>
            <view class="flex-item-3">
              <!-- v-if="item.enrollProbability" -->
              <view :class="filledVolunteer.volunteerMap.has(`${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`) ? 'volunteer-item-active' : ''" class="otherMajorBtn radius8"
                @click="addVolunteerItem(item)">
                <!-- <image :src="filledVolunteer.volunteerMap.has(`${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`) ? ImagesConstant.duigou_orange : ImagesConstant.add_orange" class="icon32" /> -->
                <text>{{ filledVolunteer.volunteerMap.has(`${item.enrollmentCode}_${item.majorCode}_${item.schoolCode}`) ? '已加入志愿' : '加入志愿表' }}</text>
              </view>
            </view>
          </view>
        </view>
        <uni-load-more :status="otherMajor.status" :content-text="contentText" />
      </scroll-view>
    </view>
  </px-popup-bottom>
  <!--其他专业 End-->
  <view v-if="recommendVolunteerList && recommendVolunteerList.length > 0">
    <my-checkvip :vip-flag="(vipInfo && vipInfo.vipLevel >= 2)" />
  </view>
  <view class="top" :style="{'display': (topFlag === true ? 'block' : 'none') }">
    <uni-icons class="topc" type="arrowthinup" size="40" @click="clickTop"></uni-icons>
  </view>
  <view style="position: fixed;padding: 15rpx 0;bottom: 0;background: white;border-top: 5rpx solid #F4F5F7; width: 100%;height: 80rpx;display: flex;justify-content: flex-end;">
    <view class="volunteer-item-active" style="position: absolute;right: 30rpx;" @click="onFillVolunteerOpen">查看志愿表{{`(${filledVolunteer.volunteerMap.size})`}}</view>  
  </view>
</template>

<style scoped lang="scss">
.uni-mt-10 {
  margin-top: 10px;
}

.divider {
  background: #f5f5f5;
  width: 100%;
  height: 3rpx;
}

.backcolorwhite {
  background-color: white !important;
}

:deep(.common-page-head) {
  padding: 10rpx !important;
}

/*重置 uni-data-picker样式*/
:deep(.uni-data-tree) {
  .placeholder {
    color: black !important;
    font-size: 14px !important;
  }

  .selected-item .text-color {
    color: black !important;
    font-size: 14px !important;
  }

  .input-value-border {
    border: none !important;
  }
}

/*成绩卡片*/
.score-card {
  background-color: #5478fb;
  color: white;
  width: 100%;
  border-radius: 20rpx;
  padding: 30rpx;
  margin: 10rpx;
}


.text-list {
  margin-top: 15rpx;
  margin-bottom: 10rpx;

  .t {
    line-height: 20rpx;
    margin-right: 15rpx;
  }
}


/*导航栏部分 start*/
.tabs {
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  background-color: #ffffff;
  /* #ifndef APP-PLUS */
  /*height: 100vh;*/
  /* #endif */

  .scroll-h {
    /*width: 750rpx;*/
    /* #ifdef H5 */
    width: 100%;
    /* #endif */
    height: 80rpx;
    flex-direction: row;
    /* #ifndef APP-PLUS */
    white-space: nowrap;
    /* #endif */
    /* flex-wrap: nowrap; */
    /* border-color: #cccccc;
  border-bottom-style: solid;
  border-bottom-width: 1px; */
  }

  .line-h {
    height: 1rpx;
    background-color: #cccccc;
  }

  .uni-tab-item {
    /* #ifndef APP-PLUS */
    display: inline-block;
    /* #endif */
    flex-wrap: nowrap;
    padding-left: 34rpx;
    padding-right: 34rpx;
  }

  .uni-tab-item2 {
    /* #ifndef APP-PLUS */
    display: inline-block;
    /* #endif */
    flex-wrap: nowrap;
    padding-left: 50rpx;
    padding-right: 50rpx;
  }


  .uni-tab-item-title {
    color: #555;
    font-size: 30rpx;
    height: 80rpx;
    line-height: 80rpx;
    flex-wrap: nowrap;
    /* #ifndef APP-PLUS */
    white-space: nowrap;
    /* #endif */
  }

  .uni-tab-item-title-active {
    color: #007AFF;
  }

  .swiper-box {
    flex: 1;
  }

  .swiper-item {
    flex: 1;
    flex-direction: row;
  }

  .scroll-v {
    flex: 1;
    /* #ifndef MP-ALIPAY */
    flex-direction: column;
    /* #endif */
    /*width: 750rpx;*/
    width: 100%;
  }

  .update-tips {
    position: absolute;
    left: 0;
    top: 41px;
    right: 0;
    padding-top: 5px;
    padding-bottom: 5px;
    background-color: #FDDD9B;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .update-tips-text {
    font-size: 14px;
    color: #ffffff;
  }

  .refresh {
    /*width: 750rpx;*/
    width: 100%;
    height: 64px;
    justify-content: center;
  }

  .refresh-view {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
  }

  .refresh-icon {
    width: 30px;
    height: 30px;
    transition-duration: .5s;
    transition-property: transform;
    transform: rotate(0deg);
    transform-origin: 15px 15px;
  }

  .refresh-icon-active {
    transform: rotate(180deg);
  }

  .loading-icon {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    color: #999999;
  }

  .loading-text {
    margin-left: 2px;
    font-size: 16px;
    color: #999999;
  }

  .loading-more {
    align-items: center;
    justify-content: center;
    padding-top: 10px;
    padding-bottom: 10px;
    text-align: center;
  }

  .loading-more-text {
    font-size: 28rpx;
    color: #999;
  }
}

/*导航栏部分 end*/

/*分页按钮*/
:deep(.uni-pagination__num) {
  flex: none !important;
}


.btn-flex {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.button {
  margin: 20px;
  width: 150px;
  font-size: 14px;
  color: #333;
}


/*顶部*/
.header {
  border-top: 3rpx solid #f6f6f6;
  background-color: white;

  //min-height: 500rpx;
  //搜索栏
  .search-view {
    width: 95%;
    margin: 0 auto;
    border-bottom: 3rpx solid #f6f6f6;
  }
}

/*搜索栏*/
:deep(.uni-searchbar) {
  padding: 15rpx 10rpx !important;
}

/*圆环进度条内字体 start*/
.progressBox {
  position: relative;
  width: 168rpx;
  height: 168rpx;
  margin-top: 33rpx;
}

.centerTxt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100rpx;
  height: 80rpx;
  margin: 10rpx auto 0 auto;
  text-align: center;

  .num {
    font-size: 30rpx;
    font-family: Arial, serif;
    font-weight: bold;
    color: #38393A;
  }

  .txt {
    font-size: 22rpx;
    font-family: PingFang SC;
    font-weight: 400;
    color: #8A8B8B;
  }

}

/*圆环进度条内字体 end*/

.tcenter {
  text-align: center;
}

.circle-active {
  /*border-bottom: 1rpx solid #3d76fd;*/
  color: #3d76fd !important;
}


/*推荐志愿列表 start*/

.fillVolunteer {
  padding-bottom: 100rpx;
  /*padding:0 30rpx 10rpx 30rpx;*/
  .volunteerItem {
    background-color: white;
    padding: 30rpx;
    margin: 10rpx 0;

    /*院校标签*/
    .tags {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
    }

    .tags .tag {
      margin-top: 10rpx;
      margin-right: 10px;
      font-size: 13px;
      line-height: 30rpx;
      color: #acadba;
      border: 3rpx solid #acadba;
      border-radius: 8rpx;
      padding: 5rpx;
    }
  }
}

//其他专业按钮
.otherMajorBtn {
  color: #f96543;
  border: 1rpx solid #f96543;
  padding: 10rpx 10rpx;
  text-align: center;
}

.volunteer-item-active {
  //background-color: #fef4f4;
  color: #ffffff;
  background: #f96543;
  border: 1rpx solid #f96543;
  padding: 10rpx 10rpx;
  text-align: center;
  height: 50rpx;
  line-height: 50rpx;
  border-radius: 10rpx;
}


.volunteerIndexs {
  color: #f96543;
  background-color: #fef3ec;
  border: 1rpx solid #f96543;
  padding: 10rpx 10rpx;
}

.addVolunteerItem {
  color: #f96543;
  border: 1rpx solid #f96543;
  padding: 10rpx 10rpx;
}

/*推荐志愿列表 end*/

:deep(.uni-noticebar) {
  margin-top: 10rpx;
}

/* 回到顶部 start*/
.top {
  position: relative;
  display: none;
  /* 先将元素隐藏 */
  transition: 0.5s;
}

.topc {
  position: fixed;
  right: 10rpx;
  //background: #F0F0F0;
  background: #e1e1e1;
  border-radius: 50%;
  top: 80%;
  height: 40px;
  line-height: 40px;
}

/* 回到顶部 end*/

/* 学历层次切换标签 */
.edu-tabs {
  display: flex;
  background: #f5f5f5;
  border-radius: 50rpx;
  padding: 10rpx;
  margin: 20rpx 20rpx;
}

.edu-tab {
  flex: 1;
  text-align: center;
  padding: 10rpx;
  border-radius: 50rpx;
  color: #666;
}

.edu-tab-active {
  background: #fff;
  color: #3d76fd;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
}

.filled-volunteer-list {
  padding: 0 20rpx;
}

.volunteer-item {
  background-color: white;
  margin-bottom: 10rpx;
  padding: 10rpx 10rpx 0rpx 0rpx;
  border-radius: 8rpx;
}

.select {
  .selectIndex {
    background-color: #feeee2;
    color: #f96712;
    width: 20rpx;
    height: 50rpx;
    margin: auto 0;
    line-height: 50rpx;
    padding: 0 20rpx;
    text-align: center;
    border-radius: 6rpx;
  }
}

.no-data {
  text-align: center;
  padding: 40rpx;
  color: #999;
}

scroll-view ::-webkit-scrollbar {
  width: 0;
  height: 0;
  background-color: transparent;
}
</style>
