<style>
    body {
        min-width: 100% !important;
    }
   .uploadFiles{
       width: 100%;
       height: 100%;
       overflow: hidden;
   }
   .uploadFiles-fixed{
       width: 100%;
       height: 100%;
       position: fixed;
       left: 0;
       right: 0;
       bottom: 0;
       z-index: 1;
       background: rgba(30,30,30,.5);
   }
   .examList-popup-box{
        width: 80%;
        margin-left: 10%;
        height: auto;
        padding: 48px 55px 82px 55px;
		box-sizing: border-box;
        background: #ffffff;
        z-index: 1;
        position: relative;
        margin-top: 100px;
        border-radius: 15px;
    }
    .examList-popup-closure{
        position: absolute;
        right: 15px;
        top: -5px;
        color: #282828;
        font-size: 32px;
    }
    .examList-popup-title{
        width: 100%;
        text-align: center;
        font-size: 17px;
        font-weight: 500;
        margin-bottom: 40px;
        color: black;
    }
    .examList-popup-icon{
		width:100px;
		height: 100px;
		display: block;
		margin: 0 auto 25px auto;
	}
    .examList-popup-content{

    }
    .examList-popup-name{
        width: 100%;
        border-radius: 50px;
        line-height: 46px;
        border: 1px solid #AAAAAA;
        text-align: center;
        outline: none;
        font-size: 14px;
    }
    button.bg-accent{
        background: linear-gradient(90deg, #C91727, #C91727) !important;
        border-color: #C91727 !important;
        width: 100%;
        height: 44px !important;
        border-radius: 50px !important;
    }
    button.bg-accent:active {
        background: linear-gradient(270deg, #C91727, #C91727) !important;
    }
    .avatar-uploader{
        width: 80%;
        margin: auto;
        color: #fff;
        margin-top: 20px;
    }
    .diy-upload-class .el-upload{
      display: block !important;
    }
</style>

<template>
    <div class="uploadFiles">
        <div class="uploadFiles-fixed"></div>
        <div class="examList-popup-box">
            <!-- <i class="examList-popup-closure" @click="closepopup">×</i> -->
            <div class="examList-popup-title">导入考试信息</div>
            <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1654136886000_860.png"
            mode="widthFix" class="examList-popup-icon"></img>
            <div class="examList-popup-content">
                <input v-model="uploadParm.params.ExamName" class="examList-popup-name" placeholder="请输入考试名称"/>
                <div class="diy-upload-class">
                    <!-- https://jjswapi.oytour.com -->
                    <el-upload class="avatar-uploader"
                      :data="uploadParm"
                      name="myfile"
                      action="https://jjswapi.oytour.com/api/Upload/UploadStuExamScore"
                      accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                      :before-upload="uploadFileCheck"
                      :on-success="uploadFileSuccess"
                      :on-error="uploadFileError"
                      :show-file-list="false"
                      :disabled="show"
                    >
                        <q-btn color="accent" size="sm" class="q-mr-md" icon="cloud_upload" label="选择文件"></q-btn>
                    </el-upload>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
  import wx from 'weixin-js-sdk'
  import {
  Notify,
  Loading
} from 'quasar'
    // import {
    //   getClassNameList,
    //   queryStudyNameList
    // } from "@/api/finance/index";

    export default {
      meta:{
        title:'上传考试成绩'
      },
      props: {

      },
      data() {
        return {
            show:false,
            loading:false,
            uploadParm:{
                params:{
                   Uid:10001,
                    CourseId:'1',
                    ExamName:'' 
                }
                
            }
        };
      },
      created() {

      },
      components: {

      },
      mounted() {
        var query=this.$route.query;
        this.uploadParm.params.Uid=query.uid
        this.uploadParm.params.CourseId=query.courseId
      },
      methods: {
        uploadFileCheck(files) {//文件上传
            if(this.uploadParm.params.ExamName.length==0){
                 Notify.create({
                  icon: "error",
                  color: "dark",
                  message: '请填写考试名称',
                  position: "top"
                });
                return false;
            }
            this.uploadParm.params = JSON.stringify(this.uploadParm.params)
            Loading.show({
              message:"正在上传文件"
            })
            return true
        },
        uploadFileSuccess(res,file,fileList){
          Loading.hide()
          if(res.Code!=1){
            Notify.create({
                  icon: "error",
                  color: "dark",
                  message: '上传失败',
                  position: "top"
                });
          }else{
            wx.miniProgram.navigateBack({
                delta:1
            })
          }
        },
        uploadFileError(){

        }
        // closepopup(){
        //     this.show = false
        //     this.uploadParm.params = {
        //         Uid:'',
        //         CourseId:'',
        //         ExamName: ''
        //     }
        // },
      },
      watch: {}
    };
</script>
