<?php
/**
 * 视频课程分类编辑
 * $Id: course_category_edit_input.inc,v 1.1 2015/10/08 11:18:53 wanggb Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 **/

?>
<div id="change">
	<p class="edit_title">视频课程分类编辑</p>
	<form id="course_category_edit" action="course_category_edit_result.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" value="<?=$id?>"/>
	<input type="hidden"  name="parent_id" value="<?=$parent_id?>"/>
	<input type="hidden" name="action_type" value="<?=$action_type?>"/>
	<div class="edit_content">
		<p>一级分类名称</p>
			<el-select v-model="parent_id" size="small">
        <el-option
            v-for="item in category_list"
            :key="item.id"
            :label="item.title"
            :value="item.id">
        </el-option>
    	</el-select>
    <p>分类名称</p>
		<el-input v-model="title" name="title" class="input_200"></el-input>
    	<br/>
		<br/>
		<el-button type="danger" @click="edit()" class="edit_btn">编辑</el-button>
		<el-button type="danger" @click="back()" class="edit_btn">返回</el-button>
		<br/><br/>
	</div>
	</form>
</div>


<script type="text/javascript">
	
	new Vue({
		el:'#change',
		data:{
			title:'<?=$title?>',
		  parent_id:<?=$parent_id?>,
		  category_list:<?=json_encode($category_list)?>
		},
		methods:{
		  back:function(){
			  window.history.go(-1);
			},
			edit:function(){
				if(!this.title){
					this.$message({
		            type: 'error',
		            message: '请输入分类名称!'
		          });
		      return;
				}
				$("input[name='parent_id']").val(this.parent_id);
				$('#course_category_edit').submit();
			}
		}
	})
</script>
