<template>
  <div id="teaStudentList">
    <el-row>
      <el-col :span="24" class="list" v-for="(item, index) in studentList" :key="index">
        <el-col :span="18" class="name">
          <p>{{ item.name }}</p>
          <p>{{ item.faculty }}&nbsp;{{ item.major }}</p>
        </el-col>
        <el-col :span="3" class="gender">
          <p>{{ item.gender }}</p>
          <p v-if="item.job">{{ item.job }}</p>
        </el-col>
        <el-col :span="3" class="btn">
          <el-link :underline="false" @click="onClick()">指派</el-link>
        </el-col>
      </el-col>
      <van-dialog v-model="show" title="指派学生职务" :showConfirmButton="false">
        <van-form @submit="onSubmit">
          <van-field v-model="form.name" name="学生名称" disabled />
          <van-field name="radio" label="学生职务">
            <van-radio-group v-model="form.job" direction="horizontal" slot="input">
              <van-radio name="班长">班长</van-radio>
              <van-radio name="学委">学委</van-radio>
            </van-radio-group>
          </van-field>
          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">
              提交
            </van-button>
          </div>
        </van-form>
      </van-dialog>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'teaStudentList',
  props: {
    studentList: null,
    show: null,
    form: null,
  },
  components: {},
  data: () => ({}),
  created() {},
  computed: {},
  methods: {
    onClick() {
      this.$emit('clickUpdate');
    },
    onSubmit() {
      this.$emit('submit', { data: this.form });
    },
  },
};
</script>

<style lang="less" scoped>
p {
  padding: 0;
  margin: 0;
}
.list {
  background: #fff;
  margin: 0 5px 5px 5px;
  width: 97%;
  padding: 0 10px;
  border-radius: 15px;
}
.name {
  padding: 10px 0 0 0;
}
.name p {
  padding: 0 0 10px 0;
}
.gender {
  padding: 10px 0 0 0;
}
.gender p {
  padding: 0 0 10px 0;
}
.btn {
  padding: 22px 0;
  text-align: center;
}
/deep/.btn .el-link {
  color: #1e90ff;
  font-size: 18px;
}
</style>
