<!--发布公告-->
<template>
  <div class="split"></div>
  <div class="contentscore">
    <a-tabs v-model:activeKey="activeKeyScore">
      <a-tab-pane key="1" tab="学员获取">
        <div class="group">
          <div class="groupleft">
            <div class="groupname" style="width: 42px">姓名：</div>
            <a-input class="ant-input"
              v-model:value="value"
              placeholder="请输入姓名"
            />
          </div>
          <div class="groupright">
            <div class="btn1">
              <img src="../../assets/images/courseManage/search0.png" />
              <span class="btn1text">搜索</span>
            </div>
            <div class="btn2">
              <img src="../../assets/images/courseManage/reset1.png" />
              <span class="btn2text">重置</span>
            </div>
          </div>
        </div>
        <div class="tableBox" style="margin: 20px 32px 30px 32px">
          <a-table 
            style="border: 1px solid #f2f6fe"
            :columns="tablecolumnStu"
            :data-source="tabledataStu"
            :loading="tableDataTotal === -1 ? true : false"
            expandRowByClick="true"
            @expand="expandTable"
            :pagination="false"
          />
          <div class="pa">
            <a-pagination
              showSizeChanger="true"
              showQuickJumper="true"
              hideOnSinglePage="true"
              :pageSize="pageSize"
              :current="currentPage"
              :total="tableDataTotal"
              class="pagination"
            />
          </div>
        </div>
      </a-tab-pane>
      <a-tab-pane key="2" tab="榜单" force-render>
        <div class="scorelist">
          <div class="grouprightscore">
            <div class="sbutton" @click="stuValue = !stuValue">
              <img v-if=stuValue src="../../assets/images/taskpage/stu0.png"/>
              <img v-else src="../../assets/images/taskpage/stu.png"/>
              <div :class="stuValue ? '' : 'btn1'">学员积分榜</div>
            </div>
            <div class="sbutton" @click="stuValue = !stuValue">
              
              <img v-if=stuValue src="../../assets/images/taskpage/group.png"/>
              <img v-else src="../../assets/images/taskpage/group0.png"/>
              <div :class="stuValue ? 'btn1' : ''">小组积分榜</div>
            </div>
          </div>
          <div class="group" style="justify-content: center">
            <div class="groupleft">
              <div class="groupname">姓名：</div>
            <a-input class="ant-input" style="width:152px"
                v-model:value="value"
                placeholder="请输入姓名"
              />
            </div>
            <div class="groupright">
              <div class="btn1" style="margin-left: 16px ;">
                <img src="../../assets/images/courseManage/search0.png" />
                <span class="btn1text">搜索</span>
              </div>
              <div class="btn2">
                <img src="../../assets/images/courseManage/reset1.png" />
                <span class="btn2text">重置</span>
              </div>
            </div>
          </div>
          <div class="radiobutton">
            <a-radio-group
              v-model:value="todayvalue"
              button-style="solid"
              @change="changeday"
            >
              <a-radio-button class="today" value="1">今天</a-radio-button>
              <a-radio-button class="today" value="2">七天</a-radio-button>
              <a-radio-button class="today" value="3">近一个月</a-radio-button>
            </a-radio-group>
          </div>
          <div class="listdiv"> <div class="slist">
              <a-list :data-source="stuValue ? datascoreg : datascore">
                <template #renderItem="{ item }">
                  <div class="item">
                    <div v-if="item.id == 1" class="itemleft">
                      <div class="itemimage">
                        <img src="../../assets/images/taskpage/gold.png" />
                      </div>
                      <div class="itemid">{{ item.id }}</div>
                    </div>
                    <div v-else-if="item.id == 2" class="itemleft">
                      <div class="itemimage">
                        <img src="../../assets/images/taskpage/siler.png" />
                      </div>
                      <div class="itemid">{{ item.id }}</div>
                    </div>
                    <div v-else-if="item.id == 3" class="itemleft">
                      <div class="itemimage">
                        <img src="../../assets/images/taskpage/copper.png" />
                      </div>
                      <div class="itemid">{{ item.id }}</div>
                    </div>
                    <div v-else class="itemleft">
                      <div class="elseid">{{ item.id }}</div>
                    </div>

                    <div class="itemcenter">{{ item.name }}</div>
                    <div class="itemright">{{ item.score }}</div>
                  </div>
                </template>
              </a-list>
            </div>
          </div>
        </div>
      </a-tab-pane>
      <a-tab-pane key="3" tab="获取规则">
        <div class="projectscore">
          <div class="pjc_body">
            <div class="groupright">
              <div class="spandiv"><span class="spantext">规则</span></div>
              <div v-if="edit" class="btns">
                <div class="btn1" @click="edit=!edit">
                <img src="../../assets/images/projectadd/edit1.png" />
                <span class="btn1text">编辑</span>
              </div>
            
              </div>
              <div v-else class="btns">
                <div class="btn1" @click="edit=!edit">
                <span class="btn1text">保存</span>
              </div>
              </div>
            </div>

            <div v-if="edit" class="pjcb_content">
              <div class="content content1">
                <span>当前设计下，学员可以获得 </span><span class="scoretext">{{scoresum}}</span><span>积分</span>
              </div>
              <div class="content content2">
                <span>完成【必修/选修】获得 </span><span class="scoretext">{{score1}} </span><span>积分</span>
              </div>
              <div class="content">
                <span>优秀学员可获得 </span><span class="scoretext">{{score2}}</span><span>积分</span>
              </div>
            </div>
            <div v-else class="pjcb_content">
              <div class="content content1">
                <span>当前设计下，学员可以获得 </span><span class="scoretext">{{scoresum}}</span><span>积分</span>
              </div>
              <div class="content content2">
                <span>完成【必修/选修】获得 </span><span ><a-input v-model:value="score1" :bordered="false" @change="getScore"/> </span><span>积分</span>
              </div>
              <div class="content ">
                <span>优秀学员可获得 </span><span ><a-input v-model:value="score2" :bordered="false" /></span><span>积分</span>
              </div>
            </div>
          </div>
        </div></a-tab-pane
      >
    </a-tabs>
  </div>
  <stu-score-detail v-model:Svisible="Svisible" />
</template>

<script>
import StuScoreDetail from "../../components/drawers/StuScoreDetail";
import { reactive, toRefs } from "vue";
export default {
  name: "ProjectScore",
  components:{
    StuScoreDetail,
  },
  setup() {
    const state = reactive({
      tabledataStu: [
        {
          key: 1,
          name: "小李",
          bum: "产研部",
          gangw: "产品经理",
          group: "好好学习",
          diploma: "0",
          operation: "查看",
          
        },
        {
          key: 2,
          name: "小刘",
          bum: "产研部",
          gangw: "产品经理",
          group: "天天向上",
          diploma: "0",
          operation: "查看",
         
        },
        {
          key: 3,
          name: "小王",
          bum: "产研部",
          gangw: "后端",
          group: "好好学习",
          diploma: "0",
          operation: "查看",
        
        },
        {
          key: 4,
          name: "小赵",
          bum: "产研部",
          gangw: "前端",
          group: "天天向上",
          diploma: "0",
          operation: "查看",
          
        },
      ],

      tablecolumnStu: [
        {
          title: "姓名",
          dataIndex: "name",
          key: "name",
          width: 30,
          align: "left",
          className: "h",
        },
        {
          title: "部门",
          dataIndex: "bum",
          key: "bum",
          width: 40,
          align: "center",
          className: "h",
        },
        {
          title: "岗位",
          dataIndex: "gangw",
          key: "gangw",
          width: 40,
          align: "center",
          className: "h",
        },
        {
          title: "所属小组",
          dataIndex: "group",
          key: "group",
          width: 40,
          align: "center",
          className: "h",
        },
        {
          title: "证书",
          dataIndex: "diploma",
          key: "diploma",
          width: 40,
          align: "center",
          className: "h",
        },
        {
          title: "操作",
          dataIndex: "operation",
          key: "operation",
          width: 60,
          align: "center",
          className: "operation",
        },
      ],
      datascore: [
        {
          id: 1,
          name: "张三的名字很长很长很长",
          score: "10分",
        },
        {
          id: 2,
          name: "李四",
          score: "10分",
        },
        {
          id: 3,
          name: "王五的名字一定要比张三的还长",
          score: "10分",
        },
        {
          id: 4,
          name: "赵六",
          score: "10分",
        },
        {
          id: 5,
          name: "冯七",
          score: "10分",
        },
      ],
      datascoreg: [
        {
          id: 1,
          name: "第一组的同学们",
          score: "10分",
        },
        {
          id: 2,
          name: "第2组的同学们",
          score: "9分",
        },
        {
          id: 3,
          name: "第3组的同学们",
          score: "8分",
        },
        {
          id: 4,
          name: "第4组的同学们",
          score: "7分",
        },
        {
          id: 5,
          name: "第五组的同学们",
          score: "6分",
        },
      ],
      valueName: "", //排行榜输入姓名
      valueDate: "", //排行榜输入日期
      noticeChecked: true,
      noticeContent: "请输入要发布的公告",
      activeKeyScore: "1",
      stuName: "请输入姓名",
      todayvalue: "1",
      tableDataTotal: 30,
      stuValue: false,
      Svisible:false,
      score1:5,
      score2:5,
      edit:true,
    });
    const getTableData = () => {
      let datas = state.tabledataStu;
      datas.map((value) => {
        {
          //单层项目
          value.operation = (
            <div class="operation">
              <div
                class="jc"
                onClick={() => {
                  state.Svisible = true;
                }}
              >
                查看
              </div>                
            </div>
          );
        }
      });
      state.tabledataStu = datas;
    };
    getTableData();
  
    return {
      ...toRefs(state),
     
    };
  },
  computed: {
    // 计算属性的 getter
    scoresum: function () {
        return Number(this.score1)+Number(this.score2);
      }
    }
};
</script>
<style lang="scss">
.contentscore {
  margin-top: 20px;
  margin-bottom: 100px;
  .ant-tabs-nav-wrap{
    border-bottom:1px solid #ededed;
  }
  .ant-tabs-tab-btn {
    font-size: 18px;
    font-weight: 700;
  }
  .ant-input {
        border-radius: 8px;
        width: 264px;
        height: 40px;
    }  
  .group {
      display: flex;
      justify-content: space-between;
      .groupleft {
        display: flex;
        align-items: center;
        margin-left: 32px;
        .groupname {        
          height: 22px;
          width: 42px;
          color: #000000;
          font-size: 14px;
        }
        
      }
      .groupright {
        display: flex;
        .btn1 {
          width: 100px;
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 16px;
          border: 1px solid #409eff;
          border-radius: 8px;
          background: #409eff;
          cursor: pointer;
          .btn1text {
            color: #ffffff;
            margin-left: 5px;
            font-size: 14px;
          }
        }
        .btn2 {
          width: 100px;
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 32px;
          border: 1px solid #409eff;
          border-radius: 8px;
          cursor: pointer;
          background: #ffffff;
          .btn2text {
            color: #409eff;
            margin-left: 5px;
            font-size: 14px;
          }
        }
      }
      
    }
  .tableBox {
      .ant-table-selection-column {
        padding: 0px !important;
        // padding-left: 45px !important;
      }

      .ant-table-thead > tr > th {
        background-color: rgba(239, 244, 252, 1) !important;
        color: rgba(0, 0, 0, 0.8500);
      }

      .ant-table-cell {
        color: rgba(0, 0, 0, 0.6500);
      }

      .ant-table-selection-column {
        padding: 0 !important;
      }

      th.h {
        background-color: #eff4fc !important;
      }

      
      .ant-table-tbody
        > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
        > td {
          
        background: #f6f9fd;
      }
      .ant-table-tbody > tr > td {
          border-bottom: 1px solid rgba(240, 244, 254, 1);
          padding: 16px 16px;
          .operation {
          color: rgba(56, 125, 247, 1);
          cursor: pointer;
          }
      }
      .pa {
        margin-top: 15px;
        // height: 20px;
        // background-color: red;
        display: flex;
        justify-content: center;
        // bottom: 20px;
      }
    }
  .scorelist {
    
    padding-bottom: 100px;
    padding-top: 50px;
    .grouprightscore {
      display: flex;
      justify-content: center;
      margin-bottom: 30px;
      text-align: center;
      .sbutton {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-left: 90px;
        margin-right: 90px;
      }

      .btn1 {
        color: #409eff;
      }
    }
    .radiobutton {
     
      margin-top: 23px;
      margin-bottom: 23px;
      justify-content: center;
      display: flex;
      text-align: center;
      .today {
        width: 120px;
        height: 32px;
      }
    }
    .listdiv{
        display: flex;
        justify-content: space-evenly;
        text-align: center;
      .slist {
      width: 736px;
      background-color: #f5f8fc;
      padding-left: 28px;
      padding-right: 28px;
      padding-bottom: 20px;
      padding-top: 16px;
      font-size: 18px;

      .item {
        display: flex;
        justify-content: space-evenly;
        text-align: center;
        border-bottom: none;
        height: 56px;
        align-items: center;
        background-color: white;
        border-radius: 21px;
        margin-top: 10px;
        .itemleft {
          justify-content: center;
          display: flex;
          align-items: center;
          width: 150px;
          .itemid {
            font-size: 40px;
            font-family: math;
            font-style: italic;
            font-weight: 700;
            color: #409eff;
            margin-left: 5px;
          }
          .elseid {
            font-size: 26px;
            font-family: math;
            font-weight: 500;
            margin-left: 40px;
          }
        }
        .itemcenter {
          width: 300px;
        }
        .itemright {
          width: 150px;
        }
      }
    }
    }
  }
  .projectscore {
  .pjc_body {
    margin-left: 34px;
    margin-right: 34px;
    .spandiv{
      position: relative;
      /* height: 100%; */
      width: 40px;
      .spantext{
        position: absolute;
        left: 0;
        bottom: 0px;
      }
      }
    
    .groupright {
        display: flex;
        justify-content: space-between;
        .btn1 {
          width: 100px;
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 16px;
          border: 1px solid #409eff;
          border-radius: 8px;
          background: #409eff;
          cursor: pointer;
          .btn1text {
            color: #ffffff;
            margin-left: 5px;
            font-size: 14px;
          }
        }
        .btn2 {
          width: 100px;
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 32px;
          border: 1px solid #409eff;
          border-radius: 8px;
          cursor: pointer;
          background: #ffffff;
          .btn2text {
            color: #409eff;
            margin-left: 5px;
            font-size: 14px;
          }
        }
      }
    .pjcb_content {
      border: 1px solid #409eff;
      padding: 20px;
      margin-top: 10px;
      .ant-input{
          width: 46px;
          font-size: 16px;
          color: #409eff;
        }
      .scoretext{
        color: #409eff;
        font-size: 16px;
        margin-left: 3px;
        margin-right: 4px;
      }
      .pjcb_content :last-child {
        margin-bottom: 0px;
      }
      .content {
        align-items: center;
        height: 50px;
        display: flex;
      }
      margin-bottom: 130px;
    }
  }
}
}


</style>
