<script>
import { arrayIsNotEmpty, stringIsNotEmpty } from "@/common/util";

const app = getApp()

// 缓存每页最多
const MAX_CACHE_DATA = 100;
// 缓存页签数量
const MAX_CACHE_PAGE = 3;

export default {
  name: "模拟填报",
  data() {
    return {
      systemName: '',
      num: { kcj: 0, jwt: 0, nlq: 0, kbd: 0 },
      circle: { kcj: 0, jwt: 0, nlq: 0, kbd: 0 }, // 百分比
      modelVale: 0,
      topFlag: false, // 显示回到顶部
      otherMajor: {
        visible: false,
        status: 'noMore',
        schoolName: '',
        nowMajor: [],
        list: [],
      }, // 其他专业数据
      selectForm: {
        province: '',
        schoolName: '',
        paneName: '全部',
        batch: '提前批',
        rulesEnrollProbabilityList: [], // 录取方式
        rulesEnrollProbability: '',
        kyjxList: [], // 科研教学
        tagsList: [], // 院校标签
        addressList: [], // 地区
        schoolNatureList: [], // 办学类型
      },
      userInfo: {},
      vipInfo: {},
      scoreInfo: {
        province: null, // 省份
        cognitioPolyclinic: null, // 科类
        professionalCategory: null, // 报考方向
        culturalScore: null, // 文化分
        professionalScore: null, // 统考分
        id: null, // 分数ID
        batch: null, // 批次
      },
      defaultSelected: [],
      menuList: app.globalData.StaticConstant.fillVolunteerMenuData,
      tabIndex: 0,
      scrollInto: "",
      newsList: [],
      cacheTab: [],
      tabBars: [],
      recommendVolunteerList: [], // 推荐志愿列表
      page: {
        current: 1,
        pageSize: 5,
        total: 0,
      }, // 分页结果
      filledVolunteer: {
        volunteerId: '',
        volunteerName: '',
        volunteerEarlyAdmissionList: [], // 本科提前批
        volunteerUndergraduateAList: [], // 本科A段
        volunteerUndergraduateBList: [], // 本科B段
        volunteerJuniorCollegeList: [], // 高职高专
        volunteerUndergraduateList: [], // 体育本科
        volunteerMap: new Map()
      }, // 已填志愿信息
      status: 'more',
      contentText: app.globalData.StaticConstant.loadContentText,
    }
  },
  onShow(e) {
    this.userInfo = uni.getStorageSync('userInfo')
  },
  onLoad(e) {
    this.systemName = app.globalData.CommonTool.getSystemName()
    this.vipInfo = uni.getStorageSync('vipInfo')
    if (e.batch && e.volunteerId) {
      //从我的志愿 点击跳转而来
      this.selectForm.batch = e.batch;
      this.filledVolunteer.volunteerId = e.volunteerId;
    }
    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: systemName+'-测一测你能上的大学', //分享标题
      path: "/pages/zyb/fillVolunteer/index"
    }
  },
  // 分享到微信朋友圈
  onShareTimeline(res) {
    return {
      title: systemName+'测一测你能上的大学', //分享标题
      path: "/pages/zyb/fillVolunteer/index"
    }
  },
  methods: {
    onConfirm(e) {
      console.log('onConfirm')
      if (e.type === 'filter' && e.children) {
        // 使用映射来简化代码
        const fieldMap = {
          '科研教学': 'kyjxList',
          '录取方式': 'rulesEnrollProbabilityList',
          '院校标签': 'tagsList',
          '办学类型': 'schoolNatureList',
          '地区': 'addressList'
        }
        
        for (let i = 0; i < e.children.length; i++) {
          const child = e.children[i]
          const field = fieldMap[child.title]
          
          if (field) {
            this.selectForm[field] = Array.isArray(child.value) ? child.value : []
          }
        }
      }
      this.clearData()
      this.getRecommendVolunteerList()
    },
    onChange(e, index) {
      console.log('onChange')
      console.log(e, index)
    },
    loadMore() {
      if (this.status === 'noMore') {
        return;
      }
      console.log('加载中')
      this.page.current++;
      this.getRecommendVolunteerList()
    },
    loadMenu() {
      //加载筛选项
      app.globalData.Request.get(app.globalData.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() {
      if (!this.vipInfo || !stringIsNotEmpty(this.vipInfo.vipLevel) || this.vipInfo.vipLevel < 2) {
        uni.showModal({
          title: 'VIP专享',
          // 提示文字
          content: '该功能为增值内容，开通会员后即可免费查看！',
          // 取消按钮的文字自定义
          cancelText: "取消",
          // 确认按钮的文字自定义
          confirmText: "开通服务",
          //删除字体的颜色
          confirmColor: 'red',
          //取消字体的颜色
          cancelColor: '#dddddd',
          success: (res) => {
            if (res.confirm) {
              // 执行确认后的操作
              this.goto('/pages/zyb/vip/index')
            }
          }
        })
        return
      }
      this.recommendVolunteerList = []
      this.selectForm.paneName = '全部'
      this.page.current = 1
      this.getRecommendVolunteerList()
    },
    goto(url) {
      uni.navigateTo({
        url: url
      })
    },
    topBack() {
      uni.pageScrollTo({
        scrollTop: 0,   // 滚动到页面的目标位置  这个是滚动到顶部, 0
        duration: 300  // 滚动动画的时长
      })
    },
    ontabtap(e) {
      //切换了 tabs
      console.log(e)
      let index = e.target.dataset.current || e.currentTarget.dataset.current;
      //判断 是否重复切换
      if (index === this.tabIndex) {
        return;
      }
      this.selectForm.batch = this.tabBars[index].id
      this.selectForm.paneName = '全部'
      //清除页数
      this.clearData()
      this.getRecommendVolunteerList()
      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 = "加载更多...";
    },
    /*填报志愿*/
    saveVolunteer(item) {
      uni.showModal({
        title: item.volunteerIndexs ? '移除志愿' : '确认志愿',
        content: '[' + item.schoolCode + ']' + item.schoolName + '-' + item.batch + '-[' + item.enrollmentCode + ']' + item.majorName,
        confirmText: '确定',
        cancelText: '取消',
        success: (res) => {
          if (res.confirm) {
            app.globalData.Request.post(app.globalData.ApiConstant.Volunteer.volunteerSave, {
              volunteerId: this.filledVolunteer.volunteerId,
              schoolCode: item.schoolCode,
              majorCode: item.majorCode,
              enrollmentCode: item.enrollmentCode,
              enrollProbability: item.enrollProbability,
              studentConvertedScore: parseFloat(item.studentConvertedScore)
            }).then(r => {
              if (r.success) {
                if (r.result) {
                  this.filledVolunteer.volunteerId = r.result
                }
                setTimeout(() => {
                  uni.showToast({title: '添加成功', icon: "none"});
                }, 500)
                this.artVolunteerDetail('load')
                setTimeout(() => {
                  this.getOtherMajorList()
                }, 500)
              } else {
                setTimeout(() => {
                  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: '本科A段', id: '本科A段'}, {
            name: '本科B段',
            id: '本科B段'
          }, {name: '高职高专', id: '高职高专'}]
        }
        // ======目前所有批次的专业都可以看到 end

        /*调整默认选中的导航栏*/
        if (this.scoreInfo.batch === '本科A段') {
          this.selectForm.batch = '提前批'
          this.tabIndex = 0;
        } else {
          for (let i = 0; i < this.tabBars.length; i++) {
            if (this.tabBars[i].id === this.selectForm.batch) {
              // 选中
              this.tabIndex = i;
              break;
            }
          }
        }
      }
      
      app.globalData.Request.get(app.globalData.ApiConstant.Volunteer.artVolunteerDetail, {id: this.filledVolunteer.volunteerId}).then(res => {
        if (res.success) {
          let dataResult = res.result
          // 有数据情况下
          const volunteerMap = new Map();
          if (dataResult) {
            // 处理 已填志愿信息
            this.filledVolunteer.volunteerId = dataResult.id
            this.filledVolunteer.volunteerName = dataResult.volunteerName
            
            // 处理各批次志愿数据
            this.processVolunteerBatch(dataResult.volunteerRecordEarlyAdmissionList, 'volunteerEarlyAdmissionList', 2);
            this.processVolunteerBatch(dataResult.volunteerRecordUndergraduateAList, 'volunteerUndergraduateAList', 12);
            this.processVolunteerBatch(dataResult.volunteerRecordUndergraduateBList, 'volunteerUndergraduateBList', 12);
            this.processVolunteerBatch(dataResult.volunteerRecordUndergraduateList, 'volunteerUndergraduateList', 12);
            this.processVolunteerBatch(dataResult.volunteerRecordJuniorCollegeList, 'volunteerJuniorCollegeList', 12);
            
          } else {
            this.filledVolunteer.volunteerEarlyAdmissionList = []
            this.filledVolunteer.volunteerUndergraduateAList = []
            this.filledVolunteer.volunteerUndergraduateBList = []
            this.filledVolunteer.volunteerJuniorCollegeList = []
            this.filledVolunteer.volunteerUndergraduateList = []
            this.filledVolunteer.volunteerList = []
          }
          this.filledVolunteer.volunteerMap = volunteerMap
        }
      }).catch(err => {
        console.error('获取志愿详情失败:', err)
      }).finally(() => {
        if (e && e === 'load') {
          this.laodRecommendVolunterList()
        } else {
          this.getRecommendVolunteerList()
        }
      });
    },
    
    // 通用处理各批次志愿数据的方法
    processVolunteerBatch(volunteerList, targetListName, maxCount) {
      const volunteerMap = this.filledVolunteer.volunteerMap;
      if (!volunteerList || !Array.isArray(volunteerList)) return;
      
      // 添加到映射表
      for (let i = 0; i < volunteerList.length; i++) {
        const item = volunteerList[i];
        const key = item.enrollmentCode + "_" + item.majorCode + "_" + item.schoolCode;
        volunteerMap.set(key, item);
      }
      
      // 生成带状态的列表（从1到maxCount）
      let result = [];
      for (let indexs = 1; indexs <= maxCount; indexs++) {
        let record = {
          actives: false,
          indexs: indexs
        }
        
        // 查找对应索引的数据
        for (let i = 0; i < volunteerList.length; i++) {
          if (volunteerList[i].indexs === indexs) {
            record = { ...volunteerList[i], actives: true };
            break;
          }
        }
        
        result.push(record);
      }
      
      this.filledVolunteer[targetListName] = result;
    },
    //刷新推荐的志愿列表的志愿填报状态
    laodRecommendVolunterList() {
      //判断专业是否已经填报过
      if (this.filledVolunteer.volunteerMap && this.recommendVolunteerList) {
        for (let i = 0; i < this.recommendVolunteerList.length; i++) {
          const item = this.recommendVolunteerList[i];
          const key = item.enrollmentCode + "_" + item.majorCode + "_" + item.schoolCode;
          const volunteer = this.filledVolunteer.volunteerMap.get(key);
          item.volunteerIndexs = volunteer ? volunteer.indexs : '';
        }
      }
    },
    //获取推荐志愿列表
    getRecommendVolunteerList() {
      this.status = 'loading'
      
      // 简化参数处理
      const kyjxStrs = this.selectForm.kyjxList?.join(',') || ''
      const tagsStrs = this.selectForm.tagsList?.join(',') || ''
      const schoolNatureStrs = this.selectForm.schoolNatureList?.join(',') || ''
      const province = arrayIsNotEmpty(this.selectForm.addressList) ? this.selectForm.addressList.join(',') : ''
      const rulesEnrollProbability = arrayIsNotEmpty(this.selectForm.rulesEnrollProbabilityList) ? 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,
      }
      
      app.globalData.Request.get(app.globalData.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 && result && records) {
            for (let i = 0; i < records.length; i++) {
              const key = records[i].enrollmentCode + "_" + records[i].majorCode + "_" + records[i].schoolCode
              const volunteer = this.filledVolunteer.volunteerMap.get(key)
              records[i].volunteerIndexs = volunteer ? volunteer.indexs : ''
            }
          }

          this.recommendVolunteerList = [...this.recommendVolunteerList, ...records]
          
          // 更新加载状态
          this.status = result.pageList.current >= result.pageList.pages ? 'noMore' : 'more'

          // 修改分页参数
          this.page.total = result.pageList.total
          this.page.current = result.pageList.current
        }
      }).catch(err => {
        console.error('获取推荐志愿列表失败:', 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 app.globalData.ImagesConstant.bao.kebaodi;
      } else if (e < 93 && e >= 74) {
        return app.globalData.ImagesConstant.bao.jiaowentuo;
      } else if (e < 74 && e >= 60) {
        return app.globalData.ImagesConstant.bao.kechongji;
      }
      return app.globalData.ImagesConstant.bao.nanluqu;
    },
    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 && e) {
        const key = e.enrollmentCode + "_" + e.majorCode + "_" + e.schoolCode
        const volunteer = this.filledVolunteer.volunteerMap.get(key)
        this.otherMajor.nowMajor.volunteerIndexs = volunteer ? volunteer.indexs : ''
      }

      // 组装查询参数
      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
      const eKey = e.enrollmentCode + "_" + e.majorCode + "_" + e.schoolCode
      this.otherMajor.status = 'loading'
      
      app.globalData.Request.get(app.globalData.ApiConstant.Major.recommendSchoolOtherMajor, params, {showLoad: false}).then(res => {
        console.log('返回值', res)
        if (res.success && res.result) {
          let records = res.result.list
          
          // 判断专业是否已经填报过
          if (this.filledVolunteer.volunteerMap && records) {
            const list = []
            for (let i = 0; i < records.length; i++) {
              const key = records[i].enrollmentCode + "_" + records[i].majorCode + "_" + records[i].schoolCode
              if (eKey === key) continue
              
              const volunteer = this.filledVolunteer.volunteerMap.get(key)
              records[i].volunteerIndexs = volunteer ? volunteer.indexs : ''
              list.push(records[i])
            }
            this.otherMajor.list = [...this.otherMajor.list, ...list]
          }
        }
      }).catch(err => {
        console.error('获取其他专业失败:', err)
      }).finally(() => {
        this.otherMajor.status = 'noMore'
      });
    },
    //打开选择其他专业
    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: (res) => {
            if (res.confirm) {
              // 执行确认后的操作
              this.goto('/pages/zyb/vip/index')
            }
          }
        })
        return
      }
    },

  },
  onPageScroll(e) { //根据距离顶部距离是否显示回到顶部按钮
    //当距离大于600时显示回到顶部按钮，//当距离小于600时隐藏回到顶部按钮
    this.topFlag = e.scrollTop > 600;
  }
}
</script>

<template>
  <view class="container">
    <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
            :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="app.globalData.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 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>
      <view class="uni-flex uni-row flex border-top" style="padding: 20rpx 0 10rpx 0">
        <view class="flex-item-05"></view>
        <view class="flex-item-2" v-if="num.nlq!==0" @click="switchPane('难录取')">
          <l-circle :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 :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 :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 :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||app.globalData.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">
              <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 ? 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 class="tag">[{{ item.enrollmentCode }}]{{ item.majorName }}</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="item.studentConvertedScore && vipInfo && vipInfo.vipLevel >= 2">
                <text>计算分</text>
                <text class="font-size-mini margin-left-10" :style="'color:'+checkColorText(item.enrollProbability)">
                  {{item.studentConvertedScore}}
                </text>
              </view>
              <!--v-if="item.studentScore"-->
              <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">
            <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.year }}省内计划录取：</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.year }}录取方式:</text>
          <text v-if="item.rulesEnrollProbability" class="blue">{{ item.rulesEnrollProbability }}</text>
          <text v-else class="blue">暂未发布</text>
        </view>
        <view class="flex-item-3">
          <view :class="item.volunteerIndexs?'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>
  <!--其他专业-->
  <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="app.globalData.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="">[{{ otherMajor.nowMajor.enrollmentCode }}]{{ otherMajor.nowMajor.majorName }}</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">
                  <text class="font-size-mini" :style="'color:'+checkColorText(otherMajor.nowMajor.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? 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: 40rpx">
              <view v-for="(history,h) in otherMajor.nowMajor.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-if="otherMajor.nowMajor.studentConvertedScore">
                  <text>折合分</text>
                  <text class="font-size-mini margin-left-10"
                        :style="'color:'+checkColorText(otherMajor.nowMajor.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? otherMajor.nowMajor.studentConvertedScore : '??' }}
                  </text>
                </view>
              </view>
              <view class="flex" style="float: right">
                <text>{{ app.globalData.StaticConstant.remote.year }}省内计划录取：</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.year }}录取方式:</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="radius10 font-weight-b" @click="saveVolunteer(otherMajor.nowMajor)"
                    :class="otherMajor.nowMajor.volunteerIndexs?'volunteerIndexs':'saveVolunteer'">
                <image :src="otherMajor.nowMajor.volunteerIndexs?app.globalData.ImagesConstant.duigou_orange:app.globalData.ImagesConstant.add_orange"
                       class="icon32"/>
                <text>{{
                    otherMajor.nowMajor.volunteerIndexs ? '志愿' + otherMajor.nowMajor.volunteerIndexs : '加入志愿表'
                  }}
                </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="">[{{ item.enrollmentCode }}]{{ item.majorName }}</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">
                  <text class="font-size-mini" :style="'color:'+checkColorText(item.enrollProbability)">
                    {{ (vipInfo && vipInfo.vipLevel >= 2) ? 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-if="item.studentConvertedScore">
                  <text>折合分</text>
                  <text class="font-size-mini margin-left-10" :style="'color:'+checkColorText(item.enrollProbability)">
                    {{ vipInfo && vipInfo.vipLevel >= 2 ? item.studentConvertedScore : '??' }}
                  </text>
                </view>
              </view>
              <view class="flex" style="float: right">
                <text>{{ app.globalData.StaticConstant.remote.year }}省内计划录取：</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.year }}录取方式:</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="radius10 font-weight-b" @click="saveVolunteer(item)"
                    :class="item.volunteerIndexs?'volunteerIndexs':'saveVolunteer'">
                <image :src="item.volunteerIndexs?app.globalData.ImagesConstant.duigou_orange:app.globalData.ImagesConstant.add_orange"
                       class="icon32"/>
                <text>{{ item.volunteerIndexs ? '志愿' + item.volunteerIndexs : '加入志愿表' }}</text>
              </view>
            </view>
          </view>
        </view>
        <uni-load-more :status="otherMajor.status" :content-text="contentText"/>
      </scroll-view>
    </view>
  </px-popup-bottom>
  <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>
</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-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: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;
}


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

.saveVolunteer {
  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*/

scroll-view ::-webkit-scrollbar {
  width: 0;
  height: 0;
  background-color: transparent;
}

</style>
