<!DOCTYPE html>
 <html>
 	<?php echo $this->fetch('head.html'); ?>

 	<body>
 		<div class="header">
 			<div class="header-back"></div>
 			<div class="header-title">在线课程</div>
 		</div>
 		<div class="header-row"></div>
 		<div class="main-body">
 			<div class="row-box mgb-10">
 				<div class="d-title"><?php echo $this->_var['data']['title']; ?></div>
 				<div class="d-desc mgb-10">
 					描述：<?php echo $this->_var['data']['description']; ?>
 				</div>

 				<div class="flex">
 					<?php if ($this->_var['data']['ispay']): ?>
 					价格：<span class="cl-money"><?php echo $this->_var['data']['money']; ?></span> 元
 					<?php endif; ?>
 					<?php if (! $this->_var['isbuy']): ?>
 					<a href="JavaScript:;" class="js-buy  mgl-5 btn-small btn-outline-primary"
 						bookid="<?php echo $this->_var['data']['bookid']; ?>">立即购买</a>
 					<?php else: ?>
 					<a class="btn-small mgl-5 btn-outline-primary"
 						href="/module.php?m=book&a=view&bookid=<?php echo $this->_var['data']['bookid']; ?>">去阅读</a>
 					<?php endif; ?>
 				</div>
 			</div>
 			<div class="row-box">

 				<div class="d-content">
 					<?php echo $this->_var['data']['content']; ?>
 				</div>
 			</div>



 		</div>
 		<?php echo $this->fetch('footer.html'); ?>

 		<script>
 			$(document).on("click", ".js-buy", function() {
 				var bookid = $(this).attr("bookid");
 				$.post("/module.php?m=book_order&a=order&ajax=1", {
 					bookid: bookid
 				}, function(data) {
 					skyToast(data.message);
 					if (data.error == 1000) {
 						window.location = '/index.php?m=login';
 						return false;
 					}
 					if (data.error == 0) {
 						if (data.data.action == 'success') {
 							window.location = "/module.php?m=book&a=view&bookid=" + bookid
 						} else if (data.data.action == "pay") {
 							window.location = data.data.payurl
 						}

 					}
 				}, "json")
 			})
 		</script>
 		<?php wx_jssdk();?>
 		<script type="text/javascript">
 			wxshare_title = "<?php echo $this->_var['data']['title']; ?>";

 			wxshare_imgUrl = "<?php echo images_site($this->_var['data']['imgurl']); ?>.100x100.jpg";
 		</script>
 	</body>
 </html>
