<template>
  <!-- 项目管理 项目基本内容 -->
  <div class="ProjectManagement1" v-loading="loading">

 <!-- 活动申请填写信息区域开始 -->
 <div class="select">
        <div class="selectTop">
          <div class="label">项目名称</div>
          <el-input v-model="content.select.projectName" placeholder="请输入内容"></el-input>
        </div>
        <div class="selectMid">
          <div class="selectLeft">
              <div class="inpBlock">
                  <div class="label">项目负责人</div>
                  <el-input v-model="content.select.leader" placeholder="请输入内容"></el-input>
              </div>
              <div class="inpBlock">
                  <div class="label">所在部门</div>
                  <el-select v-model="content.select.department" style="width: 100%;" placeholder="请选择">
                    <el-option
                      v-for="item in this.departmentOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                  </el-select>
              </div>
              <div class="inpBlock">
                  <div class="label" style="width: 50px;font-size: 14px;position: relative;top: -8px;">优先支持项目(可多选)</div>
                  <el-select style="width: 100%;" v-model="content.select.MultiSelectProjectNameS" multiple placeholder="请选择">
                    <el-option
                      v-for="item in this.MultiSelectProject"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
              </div>
              <div class="inpBlock">
                  <div class="label">联系电话</div>
                  <el-input type="number" v-model="content.select.tel"  @blur="getText(content.select.tel)" placeholder="请输入联系方式"></el-input>
              </div>
              <div class="inpBlock">
                <div class="label">选择分类</div>
                <!-- <el-cascader v-model="pageType" :options="projectApplicationApply1.sortOptions" clearable></el-cascader> -->
                <el-cascader disabled style="width: 100%;" v-model="pageType" :options="sortOptions" clearable></el-cascader>
              </div>
          </div>

          <div class="selectRight">
            <div class="inpBlock">
                  <div class="label">项目开始时间</div>
                  <el-date-picker
                    v-model="content.select.projectDate"
                    type="daterange"
                    disabled
                    style="width: 100%;"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                  </el-date-picker>
              </div>
              <div class="inpBlock" style="position: relative;">
                  <div class="label">预算总经费</div>
                  <el-input type="number" disabled v-model="content.select.fund" placeholder="请输入内容"></el-input>
                  <div style="position: absolute;right: -30px;top: 10px;">(万)</div>
              </div>
              <div class="inpBlock">
                  <div class="label" style="font-size: 14px;max-width: 50px;position: relative;top: -8px;">美丽校园改造项目(特色项目)</div>
                  <el-select v-model="content.select.schoolRemould" style="width: 100%;" placeholder="请选择">
                    <el-option
                      v-for="item in this.schoolRemouldOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
              </div>
              <div class="inpBlock">
                  <div class="label">项目申请人</div>
                  <el-select v-model="content.select.projectApplyPerson" style="width: 100%;" placeholder="请选择">
                    <el-option
                      v-for="item in this.personType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
              </div>
              <!-- <div class="inpBlock">
                  <div class="label">选择分类</div>
                  <el-cascader v-model="data.select.sort" :options="data.sortOptions" clearable></el-cascader>
              </div> -->
          </div>
        </div>
        
  </div>
        <!-- 活动申请填写信息区域结束 -->


        <!-- 项目封面修改上传开始 -->
        <!-- <div style="height: 260px;">
              <div class="tabTit">
                <div><p>封面上传</p></div>
              </div>
              <hr>
              <div style="margin-bottom: 10px;">修改项目封面</div>
              <el-progress v-show="progress.show" :percentage="progress.value" :format="ProgressFormat"></el-progress>

              <el-upload
                class="avatar-uploader"
                action="#"
                disabled
                style="position: relative;"
                :show-file-list="false"
                >
                <img v-if="content.dialogImageUrl" :src="content.dialogImageUrl" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                <BeUpload :progress="progress" style="position:absolute; width: 301px;height: 180px; opacity: 0;z-index:333;left: 0px;top: 0;" @getFile="getFile" class="uploadPic" :navName="'上传封面'" :accept="accept"></BeUpload>
              </el-upload>
        </div> -->
        <!-- 项目封面修改上传开始结束 -->

      <!-- 老师项目成员表格开始 -->
      <div class="tabTit">
                <div><p>项目组-老师成员<span>(2个学院以上,团队2-3人)</span> </p></div>
                <el-button type="primary" @click="addTeacherMember"  size="mini">添加成员</el-button>
              </div>
              <hr>
              <el-table
                :data="content.tableTeacherData"
                tooltip-effect="dark"
                stripe
                :header-cell-style="{ background: '#f2f2f2',color:'#000' }"
                class="fontSize"
                >
              
                <el-table-column
                  prop="name"
                  label="姓名"
                  align="center"
                  >
                </el-table-column>
                <el-table-column
                  prop="class"
                  label="所在学院/部门/专业"
                  align="center"
                  >
                </el-table-column>

                <el-table-column
                  prop="division"
                  label="项目组角色分工"
                  align="center"
                  >
                </el-table-column>

              
                
                <el-table-column
                  align="center"
                  prop="operation"
                  label="操作"
                  >
                  <template #default="scope">
                      <div class="operations">
                          <!-- <el-button type="primary" > -->
                              <el-button type="primary" @click="amendTeacherDialogData(scope.$index)" size="mini">修改</el-button>
                              <el-button type="primary" @click="DelTeacher(scope.$index)" size="mini">删除</el-button>
                          <!-- </el-button> -->
                      </div>
                  </template>
                </el-table-column>
              </el-table>

          <!--添加修改老师成员dialog对话框开始 -->
            <el-dialog
                :title= "isAddMember==1?'添加老师成员':'修改老师成员'"
                :visible.sync="addTeacherMemberDialog"
                :modal="true"
                :close-on-click-modal="true"
                class="AddMember"
                :before-close="init">
                  <div class="littleBlock">
                    <div class="dialogLabel">姓名</div>
                    <div>
                      <el-input v-model="Member.name"></el-input>
                    </div>
                  </div>

                  <div class="littleBlock">
                    <div class="dialogLabel">所在学院/部门/专业</div>
                    <div>
                      <el-input v-model="Member.class"></el-input>
                    </div>
                  </div>

                  <div class="littleBlock">
                    <div class="dialogLabel">项目组角色分工</div>
                    <div>
                      <el-input  v-model="Member.division" ></el-input>
                    </div>
                  </div>
                  <div slot="footer" class="footer">
                    <el-button v-show="isAddMember==1" type="primary" @click="commitAddTeacher" class="AllDialogBtn" >确认提交</el-button>
                    <el-button v-show="isAddMember==2" type="primary" @click="commitAmendTeacher" class="AllDialogBtn" >确认修改</el-button>

                    <el-button @click="init" class="AllDialogBtn">取消</el-button>
                  </div>
            </el-dialog>
          <!--添加修改老师成员dialog对话框结束 -->

          <!-- 删除老师成员对话框开始 -->
          <el-dialog
              title="删除成员"
              :visible.sync="delTeacherMember"
              width="600px"
              class="pageSubmitData">
              <div class="deleteContent">确定删除老师成员?</div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="commitDelTeacherMember" class="AllDialogBtn">确认删除</el-button>
                <el-button @click="delTeacherMember=false" class="AllDialogBtn" >取消</el-button>
              </span>
            </el-dialog>
          <!-- 删除老师成员对话框结束 -->
  <!-- 老师项目成员表格结束 -->

    <!-- 学生项目成员表格开始 -->
    <div id="two" class="tabTit">
                <div><p>项目组-学生成员<span>(至少2个学院以上学生构成,团队5人以上)</span> </p></div>
                <el-button type="primary" @click="addStudentMember"  size="mini">添加成员</el-button>
              </div>
              <hr>
              <el-table
                :data="content.tableStudentData"
                tooltip-effect="dark"
                stripe
                :header-cell-style="{ background: '#f2f2f2',color:'#000' }"
                class="fontSize"
                >
              
                <el-table-column
                  prop="name"
                  label="姓名"
                  align="center"
                  >
                </el-table-column>
                <el-table-column
                  prop="class"
                  label="所在学院/部门/专业"
                  align="center"
                  >
                </el-table-column>

                <el-table-column
                  prop="division"
                  label="项目组角色分工"
                  align="center"
                  >
                </el-table-column>

              
                
                <el-table-column
                  align="center"
                  prop="operation"
                  label="操作"
                  >
                  <template #default="scope">
                      <div class="operations">
                          <!-- <el-button type="primary" > -->
                              <el-button type="primary" @click="amendStudentDialogData(scope.$index)" size="mini">修改</el-button>
                              <el-button type="primary" @click="DelStudent(scope.$index)" size="mini">删除</el-button>
                          <!-- </el-button> -->
                      </div>
                  </template>
                </el-table-column>
              </el-table>
   <!-- 学生项目成员表格结束 -->


          <!-- 项目简介开始 -->
            <div class="tabTit">
                  <div><p>项目简介</p></div>
            </div>
            <hr>
            <el-input
              type="textarea"
              :rows="6"
              resize="none"
              class="textArea"
              placeholder="请输入内容"
              v-model="content.textarea">
            </el-input>
          <!-- 项目简介结束 -->

          <!--添加修改学生成员dialog对话框开始 -->
            <el-dialog
                :title= "isAddMember==1?'添加学生成员':'修改学生成员'"
                :visible.sync="addStudentMemberDialog"
                :modal="true"
                :close-on-click-modal="true"
                class="AddMember"
                :before-close="init">
                  <div class="littleBlock">
                    <div class="dialogLabel">姓名</div>
                    <div>
                      <el-input v-model="Member.name"></el-input>
                    </div>
                  </div>

                  <div class="littleBlock">
                    <div class="dialogLabel">所在学院/部门/专业</div>
                    <div>
                      <el-input v-model="Member.class"></el-input>
                    </div>
                  </div>

                  <div class="littleBlock">
                    <div class="dialogLabel">项目组角色分工</div>
                    <div>
                      <el-input v-model="Member.division"></el-input>
                    </div>
                  </div>
                  <div slot="footer" class="footer">
                    <el-button v-show="isAddMember==1" type="primary" @click="commitAddStudent" class="AllDialogBtn" >确认提交</el-button>
                    <el-button v-show="isAddMember==2" type="primary" @click="commitAmendStudent" class="AllDialogBtn" >确认修改</el-button>

                    <el-button @click="init" class="AllDialogBtn">取消</el-button>
                  </div>
            </el-dialog>
          <!--添加修改学生成员dialog对话框结束 -->

          <!-- 删除学生成员对话框开始 -->
          <el-dialog
              title="删除成员"
              :visible.sync="delStudentMember"
              width="600px"
              class="pageSubmitData">
              <div class="deleteContent">确定删除学生成员?</div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="commitDelStudentMember" class="AllDialogBtn">确认删除</el-button>
                <el-button @click="delStudentMember=false" class="AllDialogBtn" >取消</el-button>
              </span>
            </el-dialog>
          <!-- 删除学生成员对话框结束 -->
  <!-- 学生项目成员表格结束 -->



            
    <div class="baseBtn">
      <div class="blockWidth">
        <el-button type="primary" v-show="isUpload==2"  @click="audit">立即修改</el-button>
        <el-button type="primary" v-show="isUpload==3 || isUpload==4" class="disa">立即修改</el-button>
        <!-- <el-button type="primary" v-show="apIsupload==2" class="disa">立即修改</el-button> -->
      </div>
    </div>



   <!-- 提交对话框开始 -->
        <el-dialog
          title="提示"
          :visible.sync="submitHint"
          width="600px"
          class="pageSubmitData"
          :before-close="init">
          <div class="addDialogLogo">LOGO</div>
          <div class="deleteContent">确定修改项目基本信息?</div>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitAll" class="AllDialogBtn">确认提交</el-button>
            <el-button @click="init" class="AllDialogBtn">取消</el-button>
          </span>
        </el-dialog>
      <!-- 提交对话框结束 -->





  </div>
</template>

<script>
    export default {
      data() {
        return {
          accept:"image/*",
          isAddMember:1,  //判断是添加学生还是修改学生
          apIsupload:0,  //判断是否可以修改
          progress:{   //进度条
                value:0,
                show:false
            },  
            pageType:[], //选择分类

          loading:false,
          delMember:false,
          amendMemberDialog:false,
          addMemberDialog:false,
          submitHint:false,          

          delTeacherMember:false,  //删除老师对话框
          addTeacherMemberDialog:false,   //添加修改对话框

          addStudentMemberDialog:false,   //添加学生对话框
          delStudentMember:false,      //删除学生对话框
          isUpload:'',
          endProject:'',
          textarea:'',   //项目简介
          tableData:[],   //成员列表数据

          content:{
            dialogImageUrl:"",  //封面!!!!!!!!
            tableStudentData:[],  //学生成员成员列表！！！！！！！！
            tableTeacherData:[],  //老师成员成员列表！！！！！！！
            textarea:'',   //项目简介！！！！！！！
            select:{    //要提交的数据!!!!!!!!!!!!!!!!!!!!!!!
                projectName:'',     //项目名称
                leader:'',          //项目负责人
                projectDate:[],   //开始结束日期
                department:"",   //部门
                fund:'',         //资金
                MultiSelectProjectNameS:[],   //优先支持项目
                schoolRemould:'',        //校园改造项目
                tel:'',  //电话
                projectApplyPerson:'',  //项目申请人
            },
          },


          departmentOptions: [],  //部门下拉框
          Member:{    //添加、修改成员对话框数据
              name:'',
              class:'',
              division:'',
              score:'0'
          },
          MultiSelectProject:[   //优先支持项目下拉框数据
                    {
                      value: 1,
                      label: '大赛选拔项目'
                    }, {
                      value: 2,
                      label: '落地注册项目'
                    }, {
                      value: 3,
                      label: '社会征集项目'
                    }, {
                      value: 4,
                      label: '产业命题项目'
                    }
          ],
          schoolRemouldOptions:[   //美丽校园下拉框数据
              {
                value: '1',
                label: '校园安全项目'
              }, {
                value: '2',
                label: '环境治理项目'
              }, {
                value: '3',
                label: '校园服务项目'
              }, {
                value: '4',
                label: '文创装置项目'
              }
          ],
          personType:[     //项目申请人下拉框数据
              {
                value: '1',
                label: '在校学生'
              }, {
                value: '2',
                label: '入驻学校孵化基地的初创企业法人'
              }
          ],
          sortOptions: [      //选择分类下拉框数据
              {
                value:"",
                label: '',
                children: [{
                  value: 0,
                  label: '创意组',
                },
                  {
                  value: 1,
                  label: '初创组',
                }
              ]}, 
              {
              value:"",
              label: '',
              children: [{
                value: 0,
                label: '已建设',
              }, {
                value: 1,
                label: '待建设',
              }]
            }],
            
        }
      },
      methods:{
        getText(value) {     //电话验证
          let verify = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/; //获取正则表达式 存放到verify变量中
          let result = verify.test(value.trim()); //判断输入框内容是否符合 正则表达式
          if(result){
            return result;
          }else{
            this.$message.error("请输入正确的手机号格式")
            return false;
          }
          // if()
          // return verify.test(value.trim())
          // if(!result && value != "") {
          // if(!result) {
          //       return false;
          // }else{
          //   return true;
          // }
        },
        ProgressFormat(value){        //进度条
          return value ==100?'100%':`${value}%`
        },
        // getFile(val) {       //上传封面
        //     // console.log(val);
        //     this.progress.show = false;
        //     this.content.dialogImageUrl=val.url
        //     this.$message.success('上传成功')
        // },



        // 项目组老师成员方法开始
                  addTeacherMember(){   //添加项目成员对话框显示
                    this.addTeacherMemberDialog=true
                    for(let i in this.Member){
                      if(i=='score')this.Member[i] = "0"
                      else this.Member[i] = "";
                    }
                    this.isAddMember=1;
                  },
                  DelTeacher(val){    //删除对话框显示
                    this.delTeacherMember=true;
                    this.index=val
                  },
                  amendTeacherDialogData(val){   //修改项目成员信息对话框显示
                    Object.assign(this.Member,this.content.tableTeacherData[val])
                    this.isAddMember=2;
                    this.Member['index']=val    //为下面修改提供下标
                    // console.log(this.Member['index']);
                    this.addTeacherMemberDialog=true
                  },
                  commitAddTeacher(){   //确定添加成员  
                        console.log(this.Member.name);
                        if (this.Member.name =="" ||this.Member.name==undefined) return this.$message.error('请输入姓名')
                        if (this.Member.class=="" ||this.Member.class==undefined) return this.$message.error('请输入所在学院/部门/专业')
                        if (this.Member.division=="" ||this.Member.division==undefined) return this.$message.error('请输入项目组角色分工')
                        let newData = {};
                        for(let j in this.Member)newData[j] = this.Member[j];
                        this.content.tableTeacherData.push(newData);
                        this.$message.success('添加成功')
                        for(let i in this.Member){      
                          if(i=='score')this.Member[i] = "0"
                          else this.Member[i] = "";
                        }
                        this.init()
                  },

                  commitAmendTeacher(){   //确定修改成员
                        Object.assign(this.content.tableTeacherData[this.Member['index']],this.Member)
                        for(let k in this.Member) this.Member[k]=''
                        this.addTeacherMemberDialog=false;
                        this.$message.success('修改成功')
                  },

                  commitDelTeacherMember(){   //对话框确定删除成员
                    let a=this.index;
                    this.content.tableTeacherData.splice(a,1);
                    this.$message.success('删除成功');
                    this.delTeacherMember=false;
                  },
        // 项目组老师成员方法开始

            // 项目组学生成员方法开始
                addStudentMember(){   //添加项目成员对话框显示
                    this.addStudentMemberDialog=true
                    for(let i in this.Member){
                      if(i=='score')this.Member[i] = "0"
                      else this.Member[i] = "";
                    }
                    this.isAddMember=1;
                  },
                  DelStudent(val){    //删除对话框显示
                    this.delStudentMember=true;
                    this.index=val
                  },
                  amendStudentDialogData(val){   //修改项目成员信息对话框显示
                    Object.assign(this.Member,this.content.tableStudentData[val])
                    this.isAddMember=2;
                    this.Member['index']=val    //为下面修改提供下标
                    // console.log(this.Member['index']);
                    this.addStudentMemberDialog=true
                  },
                  commitAddStudent(){   //确定添加成员  
                        if (this.Member.name =="" ||this.Member.name==undefined) return this.$message.error('请输入姓名')
                        if (this.Member.class=="" ||this.Member.class==undefined) return this.$message.error('请输入所在学院/部门/专业')
                        if (this.Member.class=="" ||this.Member.class==undefined) return this.$message.error('请输入项目组角色分工')
                        let newData = {};
                        for(let j in this.Member)newData[j] = this.Member[j];
                        this.content.tableStudentData.push(newData);
                        this.$message.success('添加成功')
                        for(let i in this.Member){      
                          if(i=='score')this.Member[i] = "0"
                          else this.Member[i] = "";
                        }
                        this.addStudentMemberDialog=false;
                  },

                  commitAmendStudent(){   //确定修改成员
                        Object.assign(this.content.tableStudentData[this.Member['index']],this.Member)
                        for(let k in this.Member) this.Member[k]=''
                        this.addStudentMemberDialog=false;
                        this.$message.success('修改成功')

                        console.log(this.content.tableData);
                  },

                  commitDelStudentMember(){   //对话框确定删除成员
                    let a=this.index;
                    this.content.tableStudentData.splice(a,1);
                    this.$message.success('删除成功');
                    this.delStudentMember=false;
                  },
        // 项目组学生成员方法开始




        getProjectDepartmentData(){  //获取项目立项申请基础信息页面所在部门数据
              let param={
                uid:this.$store.state.userInfo.userid
              }
                this.ajax
                      .get(this.$store.state.api+'/SelectAllDepartment',param)
                      .then(res=>{
                        this.departmentOptions=res.data[0];
                      },err=>{
                        console.log(err);
                      })
            },



            getData(){     //过去基础数据
              this.loading = true;
                let param={
                    uid:this.$store.state.userInfo.userid,
                    pid:this.$route.query["pid"]
                }
                this.ajax
                    .get(this.$store.state.api+'/SelectProjectApplyDetailStudent',param)
                    .then(res=>{
                      // console.log(data.);
                        console.log(res.data);
                        let data=res.data[0][0]
    
                        // console.log(data.multiSelectProject);
                        this.content.select.projectName=data.title
                        this.content.select.leader=data.leader
                        this.content.select.projectDate=[data.startTime,data.endTime]
                        this.content.select.department=data.classid
                        this.content.select.fund=data.fund
                        this.content.select.MultiSelectProjectNameS=JSON.parse(data.multiSelectProject)
                        this.content.select.schoolRemould=data.schoolRemould
                        this.content.select.tel=data.phone
                        this.content.select.projectApplyPerson=data.projectApplyperson
                        this.content.select.dialogImageUrl=data.image
                        this.content.tableStudentData=JSON.parse(data.course_student)
                        this.content.tableTeacherData=JSON.parse(data.course_teacher)                       
                        this.content.textarea=data.brief
                        this.content.dialogImageUrl=data.image
                        this.pageType=[data.typeid,data.typeName]
                        this.isUpload=data.isupload
                        this.loading = false;
                        this.apIsupload=data.apIsupload
                        // console.log(this.content);
                    },err=>{
                        console.log(err);
                    })
            },

            getProjectTypeData(){  //获取项目立项申请基础信息页面分类数据
              let TypeList = [];
              let param={
                uid:this.$store.state.userInfo.userid
              }
                this.ajax
                      .get(this.$store.state.api+'/SelectAllType',param)
                      .then(res=>{
                       //获取主分类
                    let master = res.data[0].filter(item=>item['pid']=='');
                        //获取子分类
                        let minion = res.data[0].filter(item=>item['pid']!='');
                        master.forEach(item=>{
                          let type = {
                            value:item['id'],
                            label:item['name'],
                            children:[],
                          }
                          minion.forEach(min=>{
                            if(min['pid']==item['id']){
                              let minType = {
                                value:min['id'],
                                label:min['name']
                              }
                              type['children'].push(minType);
                            }
                          })
                          TypeList.push(type);
                        })
                        this.sortOptions = TypeList;
                      },err=>{
                        console.log(err);
                      })
            },
            audit(){   //提交对话框显示
              this.submitHint=true
            },

        submitAll(){   //提交修改数据
          let param={
            uid:this.$store.state.userInfo.userid,
            pid:this.$route.query['pid'],
            tit:this.content.select.projectName,
            lea:this.content.select.leader,
            cla:this.content.select.department,
            mul:JSON.stringify(this.content.select.MultiSelectProjectNameS),
            pho:this.content.select.tel,
            sch:this.content.select.schoolRemould,
            per:this.content.select.projectApplyPerson,
            img:this.content.dialogImageUrl,
            cot:JSON.stringify(this.content.tableTeacherData),
            cos:JSON.stringify(this.content.tableStudentData),
            bri:this.content.textarea,
          }

          const cEmpty = /^\s*$/g;
              for(let i in param){
                switch(i){
                  case 'tit':
                    if(cEmpty.test(param[i]))return this.$message.error("项目名称不能为空")
                    break;
                  case 'lea':
                    if(cEmpty.test(param[i]))return this.$message.error("项目负责人不能为空")
                    break;
                  case 'cla':
                    if(cEmpty.test(param[i]))return this.$message.error("请选择项目所属部门")
                    break;
                  case 'mul':
                    console.log(111);
                    if(!JSON.parse(param[i]).length) return this.$message.error("请选择优先支持项目")
                    break;
                  case 'sch':
                    if(!param[i])return this.$message.error("请选择美丽校园改造项目")
                    break;
                  case "pho":
                    if(cEmpty.test(param[i]))return this.$message.error("请输入联系方式")
                    break;
                  case 'person':
                    if(cEmpty.test(param[i]))return this.$message.error("请选择项目申请人")
                    break;
                  case 'img':
                    if(cEmpty.test(param[i]))return this.$message.error("请选择项目封面图片")
                    break;
                  case 'cot':
                    if(JSON.parse(param[i]).length<2 || JSON.parse(param[i]).length>3)return this.$message.error("需要教师团队2-3人，至少应包含1名教研室主任")
                    break;
                  case 'cos':
                    if(JSON.parse(param[i]).length<5)return this.$message.error("需要学生团队5人以上")
                    break;
                  case 'bri':
                    if(param[i].length<200 || param[i].length>=300)return this.$message.error("项目简介需要200-300字")
                    break;
                }
              }
            this.ajax
                  .post(this.$store.state.api+'/updateProjectApplyDetailStudent',param)
                  .then(res=>{
                    // console.log(res);
                    if (res.data==1) {
                      this.$message.success('修改成功')
                      this.submitHint=false
                      this.getData()
                      return
                    }
                    this.$message.error('修改失败')
                  },err=>{
                    console.log(err);
                  })
        },
        init(){
          this.addStudentMemberDialog=false;
          this.submitHint=false;
          this.addTeacherMemberDialog=false;
        },

      },
      mounted(){    //数据加载完成后触发
        this.getProjectDepartmentData()
        this.getData()
        this.getProjectTypeData()
      },
    }
</script>

<style lang="less">
.projectApplication1{

  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    // position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 300px;
    // height: 100%;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 300px;
    height:178px !important;
    display: block;
  }
}
</style>