<template>
  <div class="app-container"  style="width: 80%;">
    <el-descriptions title="基本信息" :column="2" border style="color: #6379bb;padding-left: 20%">
      <el-descriptions-item label="当前模式">88</el-descriptions-item>
      <el-descriptions-item label="模拟类型">90</el-descriptions-item>
      <el-descriptions-item label="模拟状态">30</el-descriptions-item>
      <el-descriptions-item label="考试学员">30</el-descriptions-item>
      <el-descriptions-item label="学员座号">30</el-descriptions-item>
    </el-descriptions>

    <el-descriptions title="注意事项" :column="1" border style="margin-top: 2%;color: #6379bb;padding-left: 20%"></el-descriptions>
    <div class="shixiang">
        <div>1.注意事项111</div>
        <div>2.注意事项222</div>
        <div>3.注意事项333</div>
    </div>

    <el-form ref="elForm" :model="form"  size="medium" label-width="100px" style="margin-top: 10%;">
        <el-form-item size="large">
            <el-button type="primary" @click="submitForm" >开始练习</el-button>
        </el-form-item>
    </el-form>


  </div>
</template>

<style>
.el-form-item__content{
  /* margin-top: 15%; */
  text-align: center;
}
.shixiang{
    color: rgb(192, 74, 84);
    height: 30px;
    line-height: 30px;
    padding-left: 22%
}
</style>
<script>
import { listUser } from "@/api/system/user";
export default {
  name: "AuthRole",
  data() {
    return {
       // 遮罩层
      loading: true,
      // 分页信息
      total: 0,
      pageNum: 1,
      pageSize: 10,
      // 选中角色编号
      roleIds:[],
      // 角色信息
      roles: [],
      // 用户信息
      form: {},
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined
      },
    };
  },
  created() {
    const userId = this.$route.params && this.$route.params.userId;
    if (userId) {
      this.loading = true;
      getAuthRole(userId).then((response) => {
        this.form = response.user;
        this.roles = response.roles;
        this.total = this.roles.length;
        this.$nextTick(() => {
          this.roles.forEach((row) => {
            if (row.flag) {
              // this.$refs.table.toggleRowSelection(row);
            }
          });
        });
        this.loading = false;
      });
    }
  },
  methods: {
    /** 单击选中行数据 */
    clickRow(row) {
      // this.$refs.table.toggleRowSelection(row);
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.roleIds = selection.map((item) => item.roleId);
    },
    /** 提交按钮 */
    submitForm() {
      const userId = this.form.userId;
      const roleIds = this.roleIds.join(",");
    //   updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
    //     this.$modal.msgSuccess("授权成功");
    //     this.close();
    //   });
    this.$router.push("/people/train-train2/trainid/5");
    },
    /** 关闭按钮 */
    close() {
      const obj = { path: "/system/user" };
      this.$tab.closeOpenPage(obj);
    },
  },
};
</script>