$(document).ready(function () {
  var post_max = document.media_upload.post_max.value;
  var upload_max = document.media_upload.upload_max.value;
  $('#file_max_size').html((post_max >upload_max?upload_max:post_max));
})

function popAddTag(){
  var html_data = '<div style="padding-left:20px;">';
  html_data += '<p>视频标签名</p>';
  html_data += '<div class="input_200 el-input">';
  html_data += '<input type="text" autocomplete="off" id="media_tag" class="el-input__inner"></div><br/>';
  html_data += '<button type="button" class="el-button height_30 el-button--primary" onClick="addTag()" >确定</button>';
  html_data += '<br/><br/></div>';
  doSelectPopup(html_data);
}

function addTag(){
  requestUrl = "ajax_add_media_tag.php?tag=" + document.getElementById("media_tag").value;
  $.getJSON(requestUrl, function(json){
   
    if(json.status == 'NG'){
      v.$message({
        type: 'error',
        message: json.error_message
      });
    }else{
      closeSelectPopup();
      v.$message({
        type: 'success',
        message: '添加成功!'
      });
    }
  });
}

function popAddCourse(){
  var html_data = '<div style="padding-left:20px;">';
  html_data += '<p>合集名称</p>';
  html_data += '<div class="input_200 el-input">';
  html_data += '<input type="text" autocomplete="off" id="media_tag" class="el-input__inner"></div><br/>';
  html_data += '<p>合集封面图</p>';
  html_data += '<div><ul class="el-upload-list el-upload-list--picture-card"></ul>';
  html_data += '<div tabindex="0" class="el-upload el-upload--picture-card"><i class="el-icon-plus"></i><input type="file" name="course_front_image" accept="image/png,image/gif,image/jpg,image/jpeg" class="el-upload__input"></div></div>';
  
//  html_data += '<el-upload accept="image/png,image/gif,image/jpg,image/jpeg" list-type="picture-card" :on-change="handleChangeImg"'+
//  ' :before-upload="onBeforeUploadImg"'+  ' :auto-upload="false"'+  ' :file-list="courseImgFileList"'+  ' name="course_front_image">'+  ' <i class="el-icon-plus"></i>'+
//  '</el-upload>';
  html_data += '<p>讲师介绍</p>';
  html_data += '<el-input  type="textarea"  :rows="4"  placeholder="请输入内容" name="teacher_profile" v-model="teacher_profile"></el-input>';
  html_data += '<button type="button" class="el-button height_30 el-button--primary" onClick="addTag()" >确定</button>';
  html_data += '<br/><br/></div>';
  //html_data = $('#add_course').html();
  doSelectPopup(html_data);
}

