<?php
if (!defined('ROOT'))
	exit ;
$uid=session("user_auth.id");
$userconfig=userconfig_get($uid);
?>
<!DOCTYPE html>
<html>

	<head>
		<title>目录管理</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
		include 'Inc_files.php'; 
		?>
		<style type="text/css">
		#list_folder{ color: #333;}
		#list_folder li{ padding-bottom: 10px; cursor: default; height: 135px;}
		#list_folder .iconfont{color: #FFD215; font-size: 18px;}
		#list_folder input{ margin: -10px auto 0; border: none;}
		#list_folder .about{ color: #999;}
		#list_folder th{font-size: 14px; font-weight: 400; border-top: none;}
		#list_folder.am-table-hover>tbody>tr:hover>td,#list_folder.am-table-hover>tbody>tr:hover>th{background:#F6FAFF;}
		#list_folder .tools{display: none;}
		#list_folder tr:hover .tools{ display: block;}
		#list_folder .tools .iconfont{ color: #3B8CFF;cursor:pointer}
		#list_folder .notice{display:none; color:#999}
		#list_folder tr:hover .notice{ display: block;}
		#list_folder th,#list_folder td{ height: 45px;}
		#list_folder .col_more{ display: none;}
		
		.folder_current_handle{ cursor:pointer;}
		
		#folder .nofolder{ text-align: center;}
		#folder .nofolder .iconfont{ font-size: 50px; vertical-align:middle;}
		#folder .btns .am-btn{ height: 32px; overflow: hidden;}
		.ng_hide{ display:none;}
		
		#upload{width: 650px;height: auto;border: 1px solid #efefef;position: fixed;bottom: 0;right: 0;z-index: 99999;background: #FFF;padding: 10px 0; display: none;}
		#upload dl{margin: 0;}
		#upload dl dt{line-height: 40px;font-size: 14px;padding: 0 10px;}
		#upload dl dt .iconfont{float: right;width: 40px;height: 40px;text-align: center;}
		#upload dl dt .huifu{display: none;}
		#upload dl dd{line-height: 30px;font-size: 12px;color: #FFF;background: #5FA5FB;padding: 0 10px;}
		#upload ul{padding: 0;}
		#upload ul li{padding: 0 5px;border-bottom: 1px solid #efefef ;position: relative;height: 50px; line-height:50px;width: 100%; overflow: hidden; font-size: 14px;}
		#upload ul li span{display: inline-block;color: #52525A;font-size: 12px;}
		#upload ul li .icon{width: 60px;}
		#upload ul li .icon .iconfont{font-size: 30px;color: #FF7742;}
		#upload ul li .name{width: 200px;}
		#upload ul li .size{width: 120px;}
		#upload ul li .wja{width: 120px;color: #5E9EFF;}
		#upload ul li .file{z-index: 999999;width: 100%;position: absolute;}
		#upload ul li .jindu{background: rgba(226,237,255,0.5);position: absolute;left: 0;top: 0;height: 100%;}
		#upload .tools{float: right; padding-right: 20px; }
		#upload .tools .iconfont{color: #005F27;}
		
		.webuploader-element-invisible { position: absolute !important; clip: rect(1px 1px 1px 1px);
			clip: rect(1px, 1px, 1px, 1px);}
		#btn_file_add{position: relative;}
		#btn_file_add div{ width:100%!important; height: 100%!important;}
		
		.card_page li{ display: inline; border: 1px solid #ccc; margin: 0 5px; cursor: pointer; padding: 0 8px 3px; text-align: center;}
		.card_page li.current{ background:#28ADF1;border: 1px solid #28ADF1; color: #fff;}
		</style>
	</head>

	<body data-base64 >
		<div class="am-g tpl-g">
			<?php include 'Inc_head.php'
			?>
			<!-- 侧边导航栏 -->
			<?php
			include 'Inc_left.php';
			?>
			<!-- 内容区域 -->
			<div class="tpl-content-wrapper">
				<div class="row-content am-cf" id="folder">
					<div class="row">
						<div class="am-u-sm-12 am-u-md-12 am-u-lg-12"><i class="iconfont" style="color: #F54335; font-size: 22px;">&#xe679;</i> 右击文件夹或文件可以进行相关操作   <img src="<?php echo S('STATIC'); ?>/static/member/images/maker.png"> 文件夹内需要至少一个文件或连接，在网盘宣传页面才可以显示出目录。</div>
						<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
							<div class="widget am-cf">
								<div class="widget-head am-cf">
									<div class="widget-title  am-cf">
										<div class="am-u-sm-4">
											<a href="javascript:;" id="folder_root">网盘目录</a> <span ng-if="folder_current_name_str"><span ng-bind-html="folder_current_name_str|html"></span></span>
										</div>
										
										<div class="am-u-sm-8 btns" style="text-align: right;">
											<?php 
											if(($userconfig['usesize']/1048576)>$userconfig['wangpan_size']){?>
		                                   		<div ng-if="folder_current"  class="am-btn am-btn-sm am-btn-warning"><span class="am-icon-upload"></span> 网盘已满不能上传</div> 
		                                   	<?php }else{?>
		                                   		<div ng-show="folder_current" id="btn_file_add"  class="am-btn am-btn-sm am-btn-warning"><span class="am-icon-upload"></span> 上传文件</div>
		                                   	<?php }?>
		                                   	<button type="button" class="am-btn am-btn-sm am-btn-warning btn_col_more">显示同步ID</button>
		                                   	<button type="button" class="am-btn am-btn-sm am-btn-warning btn_del_more"><span class="am-icon-plus"></span> 批量删除</button>
		                                   	<div ng-if="folder_current"  id="btn_link_show" class="am-btn am-btn-sm am-btn-warning"><span class="am-icon-plus"></span> 新建链接</div>
		                                   	<button type="button" class="am-btn am-btn-sm am-btn-secondary btn_folder_add_show"><span class="am-icon-plus"></span> 新建文件夹</button> 
		                                   	<button type="button" class="am-btn am-btn-sm am-btn-secondary btn_folder_tongbu_show"><i class="iconfont">&#xe668;</i> 同步文件夹</button> 
		                                   	
		                                </div>
									</div>
								</div>
								<div class="widget-body  ng_hide">
									<form id="list">
										<table class="am-table am-table-hover"  id="list_folder">
											<colgroup>
												<col width="40" />
												<col width="130" ng-if="col_more" />
												<col />
												<col width="150" />
												<col width="150" />
												<col width="100" />
												<col width="50" />
												<col width="100" />
											</colgroup>
											<thead>
												<tr>
													<th class="tc"><input type="checkbox" class="btn_check_all" /></th>
													<th class="tc" ng-if="col_more">ID</th>
													<th class="tl">文件名</th>
													<th class="tc"></th>
													<th class="tr"></th>
													<th class="tc">剩余卡密</th>
													<th class="tc">同步</th>
													<th class="tc">修改日期</th>
												</tr>
											</thead>
											<tbody>
												<tr class="folder" ng-repeat="v in list_folder" data-pk1='{{v.pk1}}' data-pk2='{{v.pk2}}' data-pk3='{{v.pk3}}' data-pk4='{{v.pk4}}' data-name='{{v.name}}' data-folder='{{v.pk4}}' data-icon='{{v.icon}}' data-show_index='{{v.show_index}}' data-about='{{v.about}}' data-status='{{v.status}}' data-password='{{v.password}}' data-tongbu_password='{{v.tongbu_password}}' data-tongbu='{{v.tongbu}}' data-shoumaifenlei='{{v.shoumaifenlei}}' >
													<td class="tc"><input type="checkbox" name="pk[]" value="{{v.pk1}},{{v.pk2}},{{v.pk3}},{{v.pk4}},folder" /></td>
													<td ng-if="col_more">{{v.pk4}}</td>
													<td>
														<i class="iconfont folder"  ng-if="v.icon"><img src="<?php echo S('STATIC');?>/{{v.icon}}?imageMogr2/thumbnail/!20x20r/gravity/center/crop/20x20/interlace/1/quality/80"/></i>
														<i class="iconfont folder" ng-if="!v.icon">&#xe669;</i>
														{{v.name}}  <span class="about">{{v.about}}</span>
													</td>
													<td class="tc">
														<span class="notice">双击打开文件夹</span>
													</td>
													<td class="tr">
														<span class="tools"><i class="iconfont btn_folder_open" title="打开">&#xe768;</i> <i class="iconfont btn_folder_mod_show" title="编辑">&#xe61b;</i>  <i class="iconfont btn_folder_del" title="删除">&#xe609;</i>  </span>
													</td>
													<td class="tc">--</td>
													<td class="tc">
														<i class="iconfont" ng-if="v.tongbu=='支持'" style="color:#3BB4F2">&#xe620;</i>
														<span ng-if="v.tongbu!='支持'">--</span>
													</td>
													<td class="tr">
														{{v.pk4|date:'Y-m-d'}}
													</td>
												</tr>
												<tr class="file"  ng-repeat="v in list_file" data-pk1='{{v.pk1}}' data-pk2='{{v.pk2}}' data-pk3='{{v.pk3}}' data-pk4='{{v.pk4}}' data-name='{{v.name}}' data-folder='{{v.folder}}' data-link='{{v.link}}'  data-about='{{v.about}}' data-zengkashuliang='{{v.zengkashuliang}}' data-iskucun='{{v.iskucun}}' data-iszengsong='{{v.iszengsong}}' data-price='{{v.price}}' data-service='{{v.service}}' data-youhui='{{v.youhui}}' data-infotpl='{{v.infotpl}}' data-key='{{v.key}}' data-type='{{v.type}}'>
													<td class="tc"><input type="checkbox" name="pk[]" value="{{v.pk1}},{{v.pk2}},{{v.pk3}},{{v.pk4}},file" /></td>
													<td ng-if="col_more">{{v.pk4}}</td>
													<td>
														<img class="icon" src="{{v.icon}}" onerror="<?php echo S('STATIC');?>/static/public/images/filetype/reg.gif" />
														{{v.name}} {{v.size|filesize}} <span class="price" ng-if="v.price>0">￥{{v.price|price}}元</span> <span class="about">{{v.about}}</span>
													</td>
													<td class="tc"></td>
													<td class="tr">
														<span class="tools">
															<i ng-if="v.price>0" class="iconfont btn_card_add_show" title="添加卡密">&#xe638;</i>
															<i ng-if="v.key" class="iconfont btn_file_mod_show" title="编辑">&#xe61b;</i>
															<i ng-if="!v.key" class="iconfont btn_link_mod_show" title="编辑">&#xe61b;</i>  
															<i class="iconfont btn_file_del" title="删除">&#xe609;</i> 
															<a ng-if="v.downurl && v.key" href="javascript:;" target="_blank"><i class="iconfont btn_copy" title="复制下载地址" data-clipboard-text='http://<?php echo C('DOMAIN_DOWNLOAD');?>/file/show/pk1/{{v.pk1}}/pk4/{{v.pk4}}'>&#xe608;</i></a> 
															<a  href="javascript:;" target="_blank"><i class="iconfont btn_copy1" title="复制ID" data-clipboard-text='{{v.pk4}}' style="display: none;">&#xe608;</i></a> 
															<!-- backups <?php echo $userconfig['domain'].'.'.($userconfig['member_wangpan_type']>1?C('FUFEI_WANGPAN'):C('DOMAIN_WANGPAN'));?>-->
															<a ng-if="v.link" href="javascript:;" target="_blank"><i class="iconfont btn_copy" title="复制下载地址" data-clipboard-text='{{v.link}}'>&#xe608;</i></a> 
														</span>
													</td>
													<td class="tc">
														<span ng-if="v.price" style="cursor: pointer;" class="card_list_show" data-file_id='{{v.pk4}}'>{{v.card_num||0}}</span>
														<span ng-if="!v.price">--</span>
													</td>
													<td class="tc">
														--
													</td>
													<td class="tr">
														{{v.pk4|date:'Y-m-d'}}
													</td>
												</tr>
											</tbody>
										</table>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
			<div class="am-modal-dialog">
				<div class="am-modal-bd">
					输入文件夹名称
					<input type="text"  class="am-modal-prompt-input folder_name">
				</div>
				<div class="am-modal-footer">
					<span class="am-modal-btn" data-am-modal-cancel>取消</span>
					<span class="am-modal-btn" data-am-modal-confirm>提交</span>
				</div>
			</div>
		</div>
		
		<!--上传-->
		<div id="upload">
			<dl>
				<dt><span>{{upload_status}}（{{uploaded}}/{{files.length}}）<span class="cf00">单次数量请保持10个以内，若部分文件上传失败，请重新上传</span></span> &nbsp;
					<!--<i class="iconfont fr tuichu">&#xe60b;</i>-->
					<i class="iconfont fr shouqi">&#xe614;</i>
					<i class="iconfont fr huifu">&#xe611;</i>
					</dt>
				<dd>严禁利用网盘上传、传播暴力恐怖、色情违法及其他违法信息，一经发现将严格按照相关法律法规处理。</dd>
			</dl>
			<ul class="upload">
				<li ng-repeat="v in files|limitTo:10" data-id="{{v.id}}">
					<div class="file" >
						<div class="tools"><i class="iconfont" ng-if="v.percent==1">&#xe620;</i></div>{{v.size|filesize}} {{v.percent|percent}}%   {{v.name}}
					</div>
					<div class="jindu" style="width:{{v.percent|percent}}%"></div>
				</li>
			</ul>
		</div>
		<!--文件夹添加-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_folder_add">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">文件夹
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal folder_add">
						<input type="hidden" name="attr[folder_pids]" value="{{folder_current_id_str}}" />
						<input type="hidden" name="attr[folder]" value="{{folder_current}}" />
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹名称</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" name="attr[name]" class="folder_add_name">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹备注</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="最大长度不超过60" maxlength="60" name="attr[about]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹图标</label>
							<div class="am-u-sm-9" style="text-align: left;">
								<input type="hidden" placeholder="" name="attr[icon]">
								<a id="btn_folder_add_icon" class="am-btn am-btn-sm am-btn-warning"><span class="am-icon-upload"></span> <span class="uploader_txt">点击选择</span></a>
								<img src="" style="width: auto; height: 32px; display: none;" class="folder_icon_current" />
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">密码</label>
							<div class="am-u-sm-9">
								<input type="text" name="attr[password]" placeholder="留空为不加密" />
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">首页显示</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" name="attr[show_index]">
									<option value="显示">显示</option>
									<option value="隐藏">隐藏</option>
								</select>
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">是否支持同步</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" class="tongbu" name="attr[tongbu]">
									<option value="不支持" selected="selected">不支持</option>
									<option value="支持" >支持</option>
								</select>
							</div>
						</div>
						<div class="am-form-group tongbu_password">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">同步密码</label>
							<div class="am-u-sm-9">
								<input type="text" name="attr[tongbu_password]"  placeholder="若需要同步，必须设置同步密码" />
							</div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_folder_add">确认添加</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--文件夹编辑-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_folder_mod">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">文件夹编辑
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal folder_mod">
		     			<input type="hidden" name="pk2" value="{{folder_the_pk2}}" />
						<input type="hidden" name="pk3" value="{{folder_the_pk3}}" />
						<input type="hidden" name="pk4" value="{{folder_the_pk4}}" />
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹名称</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" value="{{folder_the_name}}" name="attr[name]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹备注</label>
							<div class="am-u-sm-9">
								<input type="text" maxlength="60" placeholder="最大长度不超过60" value="{{folder_the_about}}" name="attr[about]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件夹图标</label>
							<div class="am-u-sm-9" style="text-align: left;">
								<input type="hidden" placeholder="" value="{{folder_the_icon}}" name="attr[icon]">
								<a id="btn_folder_mod_icon" class="am-btn am-btn-sm am-btn-warning"><span class="am-icon-upload"></span> <span class="uploader_txt">点击选择</span></a>
								<img src="<?php echo S('STATIC');?>/{{folder_the_icon}}?imageView2/2/w/50/interlace/1/quality/80" style="width: auto; height: 32px;" class="folder_icon_current" ng-show="folder_the_icon!=''" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">密码</label>
							<div class="am-u-sm-9">
								<input type="text" name="attr[password]" value="{{folder_the_password}}" placeholder="留空为不加密" />
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">首页显示</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" name="attr[show_index]">
									<option value="显示" ng-selected="folder_the_show_index=='显示'">显示</option>
									<option value="隐藏" ng-selected="folder_the_show_index=='隐藏'">隐藏</option>
								</select>
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">售卖商品分类</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" class="tongbu" name="attr[shoumaifenlei]">
									<option value="0" ng-selected="folder_the_shoumaifenlei=='0'">否</option>
									<option value="1" ng-selected="folder_the_shoumaifenlei=='1'">是</option>
								</select>
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">是否支持同步</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" class="tongbu" name="attr[tongbu]">
									<option value="不支持" ng-selected="folder_the_tongbu=='不支持'">不支持</option>
									<option value="支持" ng-selected="folder_the_tongbu=='支持'">支持</option>
								</select>
							</div>
						</div>
						<div class="am-form-group tongbu_password">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">同步密码</label>
							<div class="am-u-sm-9">
								<input type="text" name="attr[tongbu_password]" value="{{folder_the_tongbu_password}}" placeholder="若需要同步，必须设置同步密码" />
							</div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_folder_mod_submit">确认编辑</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--文件编辑-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_file_mod">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">文件编辑
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal file_mod">
		     			<input type="hidden" name="pk2" value="{{file_the_pk2}}" />
						<input type="hidden" name="pk3" value="{{file_the_pk3}}" />
						<input type="hidden" name="pk4" value="{{file_the_pk4}}" />
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件名称</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" value="{{file_the_name}}" class="file_name" name="attr[name]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">更新文件</label>
							<div class="am-u-sm-9 tl">
								<input type="hidden" name="attr[key]" value="{{file_update_key}}" ng-if="file_update_key" />
								<input type="hidden" name="attr[qiniu]" value="{{file_update_qiniu}}" ng-if="file_update_qiniu" />
								<input type="hidden" name="attr[size]" value="{{file_update_size}}" ng-if="file_update_size" />
								<input type="hidden" name="attr[type]" value="{{file_update_type}}" ng-if="file_update_type" />
								<button type="button" class="am-btn btn_file_update" data-webuploader='{uploadSuccess_callback:file_update_callbak,uploadProgress_callback:file_update_uploadProgress_callback}' >点击上传</button> {{file_update_percentage}}
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">文件备注</label>
							<div class="am-u-sm-9">
								<input type="text" maxlength="60" placeholder="最大长度不超过60" value="{{file_the_about}}" name="attr[about]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">客服</label>
							<div class="am-u-sm-9">
								<input type="text" maxlength="60" placeholder="客服QQ号" value="{{file_the_service}}" name="attr[service]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">价格(单位元)</label>
							<div class="am-u-sm-9">
								<input type="number" step="0.01" value="{{file_the_price}}" name="attr[price]" placeholder="留空表示免费" />
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">优惠</label>
							<div class="am-u-sm-9">
								<textarea name="attr[youhui]" style="height: 100px;" placeholder="张数=价格 一行一个 如:10=5  大于10张每张5元">{{file_the_youhui}}</textarea>
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">销售模板</label>
							<div class="am-u-sm-9">
								<select name="attr[infotpl]">
									<option value="1" ng-selected="file_the_infotpl==1">时尚简约风格</option>
									<option value="2" ng-selected="file_the_infotpl==2">海浪简约风格</option>
									<option value="3" ng-selected="file_the_infotpl==3">紫色简约风格</option>
									<option value="4" ng-selected="file_the_infotpl==4">魅蓝简约风格</option>
									<option value="5" ng-selected="file_the_infotpl==5">绝地销售模板（1）</option>
									<option value="6" ng-selected="file_the_infotpl==6">DNF销售模板</option>
									<option value="7" ng-selected="file_the_infotpl==7">CF销售模板</option>
									<option value="8" ng-selected="file_the_infotpl==8">传奇销售模板</option>
									<option value="9" ng-selected="file_the_infotpl==9">简约销售模板</option>
									<option value="10" ng-selected="file_the_infotpl==10">星球时代风格</option>
									<option value="11" ng-selected="file_the_infotpl==11">绝地销售风格（2）</option>
									<option value="12" ng-selected="file_the_infotpl==12">绿色简约风格</option>
									<option value="13" ng-selected="file_the_infotpl==13">时尚有啦模板</option>
									<option value="14" ng-selected="file_the_infotpl==14">绝地销售风格（3）</option>
								
								</select>
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">目录</label>
							<div class="am-u-sm-9 folder_tree"></div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">销售卡密</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" name="attr[iszengsong]">
								<!--	<option value="" ng-selected="file_the_iszengsong==''">请选择</option>-->
									<option value="不赠送" ng-selected="file_the_iszengsong=='不赠送'">不销售卡密</option>
									<option value="赠送" ng-selected="file_the_iszengsong=='赠送'">销售卡密</option>
	
								</select>
							</div>
						</div>
						<!--<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">赠卡数量</label>
							<div class="am-u-sm-9">
								<input type="number" value="{{file_the_zengkashuliang}}" name="attr[zengkashuliang]" placeholder="购买软件赠送卡密数量" />
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">卡密库存</label>
							<div class="am-u-sm-9">
								<select id="doc-select-1" name="attr[iskucun]">
									<option value="启用" ng-selected="file_the_iskucun=='启用'">减少库存</option>
									<option value="不启用" ng-selected="file_the_iskucun=='不启用'">始终发一张卡</option>
								</select>
							</div>
						</div>-->
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_file_mod_submit">确认编辑</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--新建链接-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_link_add">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">新建链接
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal link_add">
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接名称</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" class="file_name" name="name">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接地址</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" name="link">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接备注</label>
							<div class="am-u-sm-9">
								<input type="text" maxlength="60" placeholder="最大长度不超过60"  name="about">
							</div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_link_add">确认添加</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--编辑链接-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_link_mod">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">编辑链接
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal link_mod">
		     			<input type="hidden" name="pk2" value="{{file_the_pk2}}" />
						<input type="hidden" name="pk3" value="{{file_the_pk3}}" />
						<input type="hidden" name="pk4" value="{{file_the_pk4}}" />
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接名称</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" value="{{file_the_name}}" class="file_name" name="attr[name]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接地址</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder="" name="attr[link]" value="{{file_the_link}}">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">链接备注</label>
							<div class="am-u-sm-9">
								<input type="text" maxlength="60" value="{{file_the_about}}" placeholder="最大长度不超过60"  name="attr[about]">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">目录</label>
							<div class="am-u-sm-9 folder_tree"></div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_link_mod">确认编辑</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--文件夹同步-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_folder_tongbu">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">文件夹同步
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal folder_tongbu">
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">用户ID</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder=""  name="pk1">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">目录ID</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder=""  name="pk4">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-ipt-3" class="am-u-sm-3 am-form-label">同步密码</label>
							<div class="am-u-sm-9">
								<input type="text" placeholder=""  name="tongbu_password">
							</div>
						</div>
						<div class="am-form-group">
							<label for="doc-select-1" class="am-u-sm-3 am-form-label">存放目录</label>
							<div class="am-u-sm-9 folder_tree"></div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_folder_tongbu_submit">确认同步</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--添加卡密-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_card_add">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">添加卡密
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		     		<form class="am-form am-form-horizontal card_add">
		     			<input type="hidden" name="file_id" value="{{folder_the_pk4}}" />
						<div class="am-form-group">
							<textarea name="cards" rows="20" cols="" placeholder="一行一个，最多200条"></textarea>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-12">
								<button type="button" class="am-btn am-btn-secondary btn_card_add">确认添加</button>
							</div>
						</div>
					</form>
		    	</div>
		  	</div>
		</div>
		<!--卡密管理-->
		<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal_card_list">
			<div class="am-modal-dialog">
		  		<div class="am-modal-hd">卡密管理
		    		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		    	</div>
		    	<div class="am-modal-bd">
		    		<div class="tl" style="padding-bottom: 5px;">
			    		<button type="button" class="am-btn am-btn-warning am-btn-xs btn_card_del_more">批量删除</button>
			    		<button type="button" class="am-btn am-btn-secondary am-btn-xs btn_card_del_all" data-file_id='{{card_file_id}}'>清空卡密</button>
			    	</div>
		    		<div style="height: 380px; overflow-y: scroll;">
		    			<form class="card_list_from">
			    			<table class="am-table am-table-bordered am-table-striped am-table-compact">
			    				<colgroup>
			    					<col width="30" />
			    					<col />
			    					<col width="50" />
			    				</colgroup>
			    				<tr>
			    					<th class="tc"><input type="checkbox"  id="card_select_all"  /></th>
			    					<th class="tc">卡密</th>
			    					<th class="tc">操作</th>
			    				</tr>
				    			<tr ng-repeat="v in card_list">
				    				<td class="tc"><input type="checkbox" name="card_id[]"  class="card_select" value='{"pk1":"{{v.pk1}}","pk2":"{{v.pk2}}","pk3":"{{v.pk3}}","pk4":"{{v.pk4}}","file_id":"{{v.file_id}}"}'  /></td>
				    				<td class="tl">{{v.card}}</td>
				    				<td><a href="javascipt:;" data-id='{"pk1":"{{v.pk1}}","pk2":"{{v.pk2}}","pk3":"{{v.pk3}}","pk4":"{{v.pk4}}","file_id":"{{v.file_id}}"}' class="btn_card_del"><i class="iconfont" title="删除">&#xe609;</i></a></td>
				    			</tr>
				    		</table>
			    		</form>
		    		</div>
		    		
		     		<ul class="card_page">
		     			<li class="card_prev"  ng-if="card_pageGroup>0">&lt;&lt;</li>
		     			<li ng-repeat="v in card_pages" data-page='{{v}}'>{{v}}</li>
		     			<li class="card_next" ng-if="card_npk">&gt;&gt;</li>
		     		</ul>
		    	</div>
		  	</div>
		</div>
		<div class="am-modal am-modal-confirm" tabindex="-1" id="del-file-confirm">
		  <div class="am-modal-dialog">
		    <div class="am-modal-hd">温馨提示</div>
		    <div class="am-modal-bd">是否确定删除文件</div>
		    <div class="am-modal-footer">
		      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
		      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
		    </div>
		  </div>
		</div>
		<?php
		include 'Inc_files_boot1.php';
		?>
		<link rel="stylesheet" type="text/css" href="/static/home/css/smartMenu.css"/>
		<script type="text/javascript">
		var wangpan_max=<?php echo $userconfig['wangpan_max']*1048576;?>;
		var file_qiniu="QINIU_FILE<?php echo C('QINIU_FILE1');?>";
		var userconfig=<?php echo json_encode($userconfig);?>
		</script>
		<script src="/static/public/js/webuploader/webuploader.min.js" type="text/javascript"></script>
		<script src="/static/public/js/webuploader/qiniu.js" type="text/javascript"></script>
		<script src="/static/home/js/jquery-smartMenu.js" type="text/javascript"></script>
		<script src="<?php echo C('TMPL_PARSE_STRING.__TPL__'); ?>/assets/js/theme.js"></script>
		<script src="/static/public/js/ots_page.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/public/js/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/member/js/folder_lists.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/member/js/card.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			jQuery(document).ready(function($){ 
				scope.upload_status='正在上传';
				scope.folder_current_name=[];
				scope.folder_current_id=[];
				scope.folder_current_name_str='';
				scope.folder_current_id_str='';
				scope.folder_current='';
				scope.uploaded=0;
				scope.$apply();
				try{
					folder();
				}catch(e){
				}
			    try{
			    	//右键菜单
			    	jQuery("#folder").smartMenu([
			        	[{text:'新建文件夹',callback:function () {
			        		folder_add_show();
			        	}}]
			        ],{
			        	beforeShow: function() {
			        		jQuery.smartMenu.remove();
			        	}
			        });
			        
			    }catch(e){}
			    
			    
			    
			});
			/***********操作事件开始**********/
			//批量选择
			jQuery(document).on('click','.btn_check_all',function () {
			    var the=jQuery(this);
			    if (the.prop('checked')) {
			    	jQuery('[name="pk[]"]').prop('checked',true);
			    }else{
			    	jQuery('[name="pk[]"]').prop('checked',false);
			    }         
			});
			//批量删除
			jQuery(document).on('click','.btn_del_more',function () {
			    var the=jQuery(this);
       			jQuery.ajax({
			    	url:"/index/del_more",
			        data:jQuery("#list").serializeArray(),
			        dataType: "json",
			        type: "post",
			        timeout: 10000,
			        success: function(data) {
			           console.log(data); 
			        },
			        error: function() {
			            mui.toast("网络连接超时");
			        }
			    });
			    jQuery(".btn_check_all").prop('checked',false);
			    jQuery("[name='pk[]']").each(function (index) {
       				if (jQuery(this).prop('checked')) {
       					jQuery(this).closest('tr').remove();
       				}
       			}); 
			})
			//删除文件夹
			jQuery(document).on('click','.btn_folder_del',function () {
				var the=jQuery(this);
    			folder_mod({
    				data:{
						pk1:the.closest('tr').data('pk1'),
						pk2:the.closest('tr').data('pk2'),
						pk3:the.closest('tr').data('pk3'),
						pk4:the.closest('tr').data('pk4'),
						attr:{status:-1}
					}
    			});
    			the.closest('tr').remove();
			})
			//返回到根目录
			jQuery(document).on('click','#folder_root',function () {
				scope.folder_current_name=[];
				scope.folder_current_id=[];
				scope.folder_current_name_str='';
				scope.folder_current_id_str='';
				scope.folder_current='';
			    folder({
					callback:function () {
						scope.$apply();
					}
				});          
			})
			
			//打开文件夹
			jQuery(document).on('dblclick','#list_folder .folder',function () {
				scope.list_folder='';
				scope.list_file='';
				scope.$apply();
				var the=jQuery(this).closest('tr');
				scope.folder_current_name.push(the.data('name'));
				scope.folder_current_id.push(the.data('pk4'));
				scope.folder_current_name_str='';
				scope.folder_current_id_str=scope.folder_current_id.join(',');
				for(var i in scope.folder_current_id){
					scope.folder_current_name_str+=' / <span data-id="'+scope.folder_current_id[i]+'" class="folder_current_handle" data-index="'+i+'">'+scope.folder_current_name[i]+'</span>';
				}
				scope.folder_current=the.data('folder');
				scope.$apply();
				folder({
					callback:function () {
						scope.$apply();
						//右键菜单
				    	jQuery("#folder").smartMenu([
				        	[{text:'新建文件夹',callback:function () {
				        		folder_add_show();
				        	}},{text:'上传文件',callback:function () {
				        		jQuery(".folder_name").val('');
				        		jQuery("#btn_file_add").click();
				        	}}]
				        ],{
				        	beforeShow: function() {
				        		jQuery.smartMenu.remove();
				        	}
				        });
					}
				});
			});
			jQuery(document).on('click','.btn_folder_open',function () {
				scope.list_folder='';
				scope.list_file='';
				scope.$apply();
				var the=jQuery(this).closest('tr');
				scope.folder_current_name.push(the.data('name'));
				scope.folder_current_id.push(the.data('pk4'));
				scope.folder_current_name_str='';
				scope.folder_current_id_str=scope.folder_current_id.join(',');
				for(var i in scope.folder_current_id){
					scope.folder_current_name_str+=' / <span data-id="'+scope.folder_current_id[i]+'" class="folder_current_handle" data-index="'+i+'">'+scope.folder_current_name[i]+'</span>';
				}
				scope.folder_current=the.data('folder');
				scope.$apply();
				folder({
					callback:function () {
						scope.$apply();
						//右键菜单
				    	jQuery("#folder").smartMenu([
				        	[{text:'新建文件夹',callback:function () {
				        		folder_add_show();
				        	}},{text:'上传文件',callback:function () {
				        		jQuery(".folder_name").val('');
				        		jQuery("#btn_file_add").click();
				        	}}]
				        ],{
				        	beforeShow: function() {
				        		jQuery.smartMenu.remove();
				        	}
				        });
					}
				});
			});
			//编辑文件夹
			jQuery(document).on('click','.btn_folder_mod_show',function () {
			    var the=jQuery(this);
				folder_mod_show(the);          
			});
			jQuery(document).on('click','.btn_folder_mod_submit',function () {
			    folder_mod({
			    	data:jQuery("form.folder_mod").serializeArray()
			    });
			    jQuery("#modal_folder_mod").modal('close');
			});
			//文件上传界面隐藏
			jQuery(document).on('click','.tuichu',function () {
			    jQuery('#upload').hide();          
			});
			//文件上传界面缩小
			jQuery(document).on('click','.shouqi',function () {
			    jQuery('.upload').hide();   
			    jQuery('#upload').find('dd').hide();       
			    jQuery('.shouqi').hide();       
			    jQuery('.huifu').show();       
			});
			//文件上传界面放大
			jQuery(document).on('click','.huifu',function () {
			    jQuery('.upload').show();   
			    jQuery('#upload').find('dd').show();       
			    jQuery('.huifu').hide();       
			    jQuery('.shouqi').show();       
			});
			//添加文件夹
			jQuery(document).on('click','.btn_folder_add_show',function () {
			    folder_add_show();
			});
			jQuery(document).on('click','.btn_folder_add',function () {
			    folder_add();
			    jQuery("#modal_folder_add").modal('close');
			});
			//打开文件夹
			jQuery(document).on('click','.folder_current_handle',function () {
			    var the=jQuery(this);
			   	scope.folder_current=the.data('id');
			   	scope.folder_current_id=scope.folder_current_id.slice(0,the.data('index')-0+1);
			   	scope.folder_current_name_str='';
			   	scope.folder_current_id_str=scope.folder_current_id.join(',');
			   	for(var i in scope.folder_current_id){
					scope.folder_current_name_str+=' / <span data-id="'+scope.folder_current_id[i]+'" class="folder_current_handle" data-index="'+i+'">'+scope.folder_current_name[i]+'</span>';
				}
			    folder({
					callback:function () {
						scope.$apply();
						//右键菜单
				    	jQuery("#folder").smartMenu([
				        	[{text:'新建文件夹',callback:function () {
				        		folder_add_show();
				        	}},{text:'上传文件',callback:function () {
				        		jQuery(".folder_name").val('');
				        		jQuery("#btn_file_add").click();
				        	}}]
				        ],{
				        	beforeShow: function() {
				        		jQuery.smartMenu.remove();
				        	}
				        });
					}
				});          
			})
			
			//文件修改窗口
			jQuery(document).on('click','.btn_file_mod_show',function () {
				var the=jQuery(this);
			    file_mod_show(the);       
			});
			//文件修改
			jQuery(document).on('click','.btn_file_mod_submit',function () {
			    var the=jQuery(this);
		    	scope.file_the_name=scope.file_the_name+"."+scope.file_the_suffix;
		    	jQuery('form.file_mod').find('.file_name').val( jQuery('form.file_mod').find('.file_name').val()+"."+scope.file_the_suffix);
		    	if (scope.folder_current=='') {
		    		wd_alert({
            			msg:'请选择目录',
            			timeout:3000,
            			color:'#fff',
            			background:'#f00'
            		});
		    	}
			    file_mod(jQuery('.file_mod').serializeArray(),scope.folder_current);  
			    jQuery("#modal_file_mod").modal('close'); 
			    folder();      
			});
			//文件删除
			jQuery(document).on('click','.btn_file_del',function () {
			    var the=jQuery(this);
			    if (confirm('是否确定删除文件')) {
			    	the.closest('tr').remove();
				    file_mod({
				    	pk2:the.closest('tr').data('pk2'),
				    	pk3:the.closest('tr').data('pk3'),
				    	pk4:the.closest('tr').data('pk4'),
				    	attr:{
				    		status:-1
				    	}
				    });
			    }
			})
			//新建链接
			jQuery(document).on('click','#btn_link_show',function () {
			    jQuery("#modal_link_add").modal().on('open.modal.amui',function () {
			    	jQuery(".btn_link_add").html(jQuery(".btn_link_add").html().replace('...',''));
					jQuery("form.link_add")[0].reset();
				});       
			})
			jQuery(document).on('click','.btn_link_add',function () {
			    var the=jQuery(this);  
			    if (the.html().indexOf('...')!=-1) {
			    	return false;
			    }
			    the.html(the.html()+'...');
			    jQuery.ajax({
					url:"/file/link_add",
				    data:{
				    	folder:scope.folder_current,
				    	folder_pids:scope.folder_current_id_str,
				    	name:the.closest('form').find('[name="name"]').val(),
				    	about:the.closest('form').find('[name="about"]').val(),
				    	link:the.closest('form').find('[name="link"]').val(),
				    },
				    dataType: "json",
				    type: "post",
				    timeout: 10000,
				    success: function() {
				    	jQuery("#modal_link_add").modal('close'); 
				    	folder();
				    },
				    error: function() {
				    }
				});        
			});
			jQuery(document).on('click','.btn_link_mod_show',function () {
				var the=jQuery(this);
				jQuery(".btn_link_mod").html(jQuery(".btn_link_mod").html().replace('...',''));
				scope.file_the_pk2=the.closest('tr').data('pk2');
				scope.file_the_pk3=the.closest('tr').data('pk3');
				scope.file_the_pk4=the.closest('tr').data('pk4');
				scope.file_the_name=the.closest('tr').data('name');
				scope.file_the_about=the.closest('tr').data('about');
				scope.file_the_link=the.closest('tr').data('link');
				scope.$apply();
				scope.file_the_folder=the.closest('tr').data('folder');
				jQuery(".folder_tree").load('/folder/tree/sid/'+scope.file_the_folder);
				jQuery("#modal_link_mod").modal().on('open.modal.amui',function () {
					jQuery("form.link_mod")[0].reset();
				});
			})
			jQuery(document).on('click','.btn_link_mod',function () {
			    var the=jQuery(this);  
			    if (the.html().indexOf('...')!=-1) {
			    	return false;
			    }
			    the.html(the.html()+'...');
			    file_mod(jQuery('.link_mod').serializeArray(),scope.folder_current);  
			    jQuery("#modal_link_mod").modal('close'); 
			    folder();
			});
			
			//显示更多列
			jQuery(document).on('click','.btn_col_more',function () {
				if (scope.col_more) {
					scope.col_more=false;
				}else{
					scope.col_more=true;
				}
				scope.$apply();
			});
			jQuery(document).on('click','.btn_card_add_show',function () {
				var the=jQuery(this);
				scope.folder_the_pk4=the.closest('tr').data('pk4');
				scope.$apply();
			    jQuery("#modal_card_add").modal().on('open.modal.amui',function () {
			    	jQuery("form.card_add")[0].reset();
				});          
			});
			jQuery(document).on('click','.btn_card_add',function () {
				var the=jQuery(this);
			    jQuery.ajax({
			    	url:"/file/card_add",
			        data:the.closest('form').serializeArray(),
			        dataType: "json",
			        type: "post",
			        timeout: 10000,
			        success: function(data) {
			       		if (data.status==1) {
			       			jQuery("#modal_card_add").modal('close');
			       			wd_alert({
		            			msg:'添加成功',
		            			timeout:3000,
		            			color:'#fff'
		            		});
		            		folder();
			       		}else{
			       			wd_alert({
		            			msg:data.info,
		            			timeout:3000,
		            			background:'#f00',
		            			color:'#fff'
		            		});
			       		}
			        },
			        error: function() {
			            mui.toast("网络连接超时");
			        }
			    });        
			});
			/***********操作事件结束**********/ 
			
			
			
			
			
			
			function folder_add(){
				if (jQuery('.folder_add_name').val()=='') {
					wd_alert({
            			msg:'文件夹名称不能为空',
            			timeout:3000,
            			background:'#f00',
            			color:'#fff'
            		});
            		return false;
				}
				jQuery.ajax({
					url:"/folder/add",
				    data:jQuery("form.folder_add").serializeArray(),
				    dataType: "json",
				    type: "post",
				    timeout: 10000,
				    success: function(data) {
				    	if (data.status==-1) {
				    		wd_alert({
	                			msg:data.info,
	                			timeout:3000,
	                			background:'#f00',
	                			color:'#fff'
	                		});
				    	}else{
				    		folder();
				    	}
				    	
				    },
				    error: function() {
				        mui.toast("网络连接超时");
				    }
				});
			}
			function folder_add_show(){
				jQuery("#modal_folder_add").modal().on('open.modal.amui',function () {
					jQuery("form.folder_add")[0].reset();
					jQuery("#modal_folder_add .folder_icon_current").hide();
				});
			}
			
			
			function folder_mod_show(){
				var the=arguments[0];
				scope.folder_the_pk2=the.closest('tr').data('pk2');
				scope.folder_the_pk3=the.closest('tr').data('pk3');
				scope.folder_the_pk4=the.closest('tr').data('pk4');
				scope.folder_the_name=the.closest('tr').data('name');
				scope.folder_the_about=the.closest('tr').data('about');
				scope.folder_the_icon=the.closest('tr').data('icon');
				scope.folder_the_password=the.closest('tr').data('password');
				scope.folder_the_show_index=the.closest('tr').data('show_index');
				scope.folder_the_shoumaifenlei=the.closest('tr').data('shoumaifenlei');
				scope.folder_the_tongbu=the.closest('tr').data('tongbu');
				scope.folder_the_tongbu_password=the.closest('tr').data('tongbu_password');
				scope.$apply();
				jQuery("#modal_folder_mod").modal().on('open.modal.amui',function () {
					jQuery("form.folder_mod")[0].reset();
				});
			}
			
			function file_mod_show(){
				var the=arguments[0];
				scope.file_the_pk2=the.closest('tr').data('pk2');
				scope.file_the_pk3=the.closest('tr').data('pk3');
				scope.file_the_pk4=the.closest('tr').data('pk4');
				scope.file_the_name=the.closest('tr').data('name');
				scope.file_the_about=the.closest('tr').data('about');
				scope.file_the_price=the.closest('tr').data('price');
				scope.file_the_service=the.closest('tr').data('service');
				scope.file_the_youhui=the.closest('tr').data('youhui');
				scope.file_the_infotpl=the.closest('tr').data('infotpl');
				scope.file_the_folder=the.closest('tr').data('folder');
				scope.file_the_zengkashuliang=the.closest('tr').data('zengkashuliang');
				scope.file_the_iskucun=the.closest('tr').data('iskucun');
				scope.file_the_iszengsong=the.closest('tr').data('iszengsong');
				
				
				var index1=scope.file_the_name.lastIndexOf(".");
				var index2=scope.file_the_name.length;
				scope.file_the_suffix=scope.file_the_name.substring(index1+1,index2);
				scope.file_the_name=scope.file_the_name.substring(0,index1);
				
				jQuery(".folder_tree").load('/folder/tree/sid/'+scope.file_the_folder);
				
				scope.$apply();
				jQuery("#modal_file_mod").modal().on('opened.modal.amui',function () {
					scope.file_update_percentage='';
					scope.$apply();
					webuploader(jQuery('.btn_file_update'));
					jQuery("form.file_mod")[0].reset();
				});
			}
			
			
			
			//文件夹修改
			function folder_mod(){
				var opts=typeof(arguments[0])!="undefined"?arguments[0]:{};
				jQuery.ajax({
					url: "/folder/mod",
					data: opts.data,
					dataType: "json",
					type: "post",
					timeout: 10000,
					success: function(data) {
						if (data.status==-1) {
							wd_alert({
	                			msg:data.info,
	                			timeout:3000,
	                			background:'#f00',
	                			color:'#fff'
	                		});
						}else{
							if (typeof(opts.callback)=="function") {
								opts.callback();
							}else{
								folder({
									callback:function () {
										scope.$apply();
									}
								});
							}
						}
					},
					error: function() {
						mui.toast("网络连接超时");
					}
				});
			}
			
			//文件修改
			function file_mod(data){
				console.log(JSON.stringify(data));
				jQuery.ajax({
					url: "/file/mod",
					data: data,
					dataType: "json",
					type: "post",
					timeout: 10000,
					success: function(data) {
						if (data.status==1) {
							
						}if (data.status==2) {
							folder({
								folder:arguments[1]
							}); 
						}else if(data.status==-1){
							wd_alert({
	                			msg:data.info,
	                			timeout:3000,
	                			background:'#f00',
	                			color:'#fff'
	                		});
						}
					},
					error: function() {
						mui.toast("网络连接超时");
					}
				});
			}
			
			
			
			//上传文件夹图标
			var uploader_folder_icon = new QiniuJsSDK().uploader({
				runtimes: 'html5,flash,html4', //上传模式,依次退化
				browse_button: 'btn_folder_add_icon', //上传选择的点选按钮，**必需**
				uptoken: '<?php echo $upload_token_static; ?>', //若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成
				save_key: true,   // 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`，则开启，SDK会忽略对key的处理
				domain: 'http://abc.bkt.clouddn.com/', //bucket 域名，下载资源时用到，**必需**
				get_new_uptoken: false, //设置上传文件的时候是否每次都重新获取新的token
				//container: 'container', //上传区域DOM ID，默认是browser_button的父元素，
				//max_file_size: '1000mb', //最大文件体积限制
				flash_swf_url: 'js/plupload/Moxie.swf', //引入flash,相对路径
				max_retries: 3, //上传失败最大重试次数
				dragdrop: true, //开启可拖曳上传
				//drop_element: 'container', //拖曳上传区域元素的ID，拖曳文件或文件夹后可触发上传
				chunk_size: '4mb', //分块上传时，每片的体积
				auto_start: true, //选择文件后自动上传，若关闭需要自己绑定事件触发上传,
				filters : {
				    max_file_size : '10mb',
				    mime_types: [
				        {title : "Image files", extensions : "jpg,gif,png"}, // 限定jpg,gif,png后缀上传
				    ]
				},
				multi_selection: false,
				init: {
					'FilesAdded': function(up, files) { //当文件添加到上传队列后
					},
					'BeforeUpload': function(up,file) { //当队列中的某一个文件正要开始上传前
						jQuery(".uploader_txt").html('上传中..');
						var reader = new FileReader();
				        reader.readAsDataURL(file.file_handle);
				        reader.onload = function(e){
				            jQuery("#modal_folder_add img.folder_icon_current").attr('src',this.result).show();
				        }
					},
					'UploadProgress': function(up, file) { //会在文件上传过程中不断触发，可以用此事件来显示上传进度
					},
					'UploadComplete': function(up, file) { //当上传队列中所有文件都上传完成后触发
					},
					'FileUploaded': function(up, file, info) { //当队列中的某一个文件上传完成后触发
						var re=JSON.parse(info.response);
						jQuery("#btn_folder_add_icon").prev('input').val(re.key);
						scope.up=up;
						scope.$apply();
						jQuery(".uploader_txt").html('点击选择');
					},
					'Error': function(up, err, errTip) { //当发生错误时触发监听
					}
				}
			});
			
			
			//修改文件夹图标
			var uploader_folder_icon_mod = new QiniuJsSDK().uploader({
				runtimes: 'html5,flash,html4', //上传模式,依次退化
				browse_button: 'btn_folder_mod_icon', //上传选择的点选按钮，**必需**
				uptoken: '<?php echo $upload_token_static; ?>', //若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成
				save_key: true,   // 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`，则开启，SDK会忽略对key的处理
				domain: 'http://abc.bkt.clouddn.com/', //bucket 域名，下载资源时用到，**必需**
				get_new_uptoken: false, //设置上传文件的时候是否每次都重新获取新的token
				//container: 'container', //上传区域DOM ID，默认是browser_button的父元素，
				//max_file_size: '1000mb', //最大文件体积限制
				flash_swf_url: 'js/plupload/Moxie.swf', //引入flash,相对路径
				max_retries: 3, //上传失败最大重试次数
				dragdrop: true, //开启可拖曳上传
				//drop_element: 'container', //拖曳上传区域元素的ID，拖曳文件或文件夹后可触发上传
				chunk_size: '4mb', //分块上传时，每片的体积
				auto_start: true, //选择文件后自动上传，若关闭需要自己绑定事件触发上传,
				filters : {
				    max_file_size : '10mb',
				    mime_types: [
				        {title : "Image files", extensions : "jpg,gif,png"}, // 限定jpg,gif,png后缀上传
				    ]
				},
				multi_selection: false,
				init: {
					'FilesAdded': function(up, files) { //当文件添加到上传队列后
					},
					'BeforeUpload': function(up,file) { //当队列中的某一个文件正要开始上传前
						jQuery(".uploader_txt").html('上传中..');
						var reader = new FileReader();
				        reader.readAsDataURL(file.file_handle);
				        reader.onload = function(e){
				            jQuery("#modal_folder_mod img.folder_icon_current").attr('src',this.result).show();
				        }
					},
					'UploadProgress': function(up, file) { //会在文件上传过程中不断触发，可以用此事件来显示上传进度
					},
					'UploadComplete': function(up, file) { //当上传队列中所有文件都上传完成后触发
					},
					'FileUploaded': function(up, file, info) { //当队列中的某一个文件上传完成后触发
						var re=JSON.parse(info.response);
						jQuery("#btn_folder_mod_icon").prev('input').val(re.key);
						scope.folder_the_icon=re.key;
						scope.up=up;
						scope.$apply();
						jQuery(".uploader_txt").html('点击选择');
					},
					'Error': function(up, err, errTip) { //当发生错误时触发监听
					}
				}
			});
			
			myAngular.filter("filesize", function() {
				return function(x) {
					if (x<1024) {
						x='1KB';
					}else if (x<1048576) {
						x=Math.floor(x/1024)+'KB';
					}else if(x<1073741824){
						x=Math.floor(x/1048576)+'MB';
					}else if(x<1073741824){
						x=Math.floor(x/1099511627776*100)/100+'GB';
					}
					return x;
				}
			});
			
			myAngular.filter("speed", function() {
				return function(x) {
					if (!x) {
						return '';
					}
					if (isNaN(x)) {
						return '秒传';
					}
					var f_x = parseFloat(x);
					var f_x = Math.round(x * 100) / 100;
					var s_x = f_x.toString();
					var pos_decimal = s_x.indexOf('.');
					if (pos_decimal < 0) {
						pos_decimal = s_x.length;
						s_x += '.';
					}
					while (s_x.length <= pos_decimal + 2) {
						s_x += '0';
					}
					return s_x+'M/S';
				}
			});
			function webuploader(the){
				
				var opts=the.attr("data-webuploader")?the.attr("data-webuploader"):"{}";
				opts=eval("(" +opts+ ")");
				var auto=typeof(opts.auto)!="undefined"?opts.auto:true;//自动上传
				var swf=typeof(opts.swf)!="undefined"?opts.swf:'/Static/Public/images/Uploader.swf';//flash
				var server=typeof(opts.server)!="undefined"?opts.server:'http://upload.qiniu.com';//上传地址
				var tokenUrl=typeof(opts.tokenUrl)!="undefined"?opts.tokenUrl:'/api/upload_token_file';
				var hash=typeof(opts.hash)!="undefined"?opts.hash:true;
				var pick=typeof(opts.pick)!="undefined"?opts.pick:the;
				var width=typeof(opts.width)!="undefined"?opts.width:100;//缩微图宽度
				var height=typeof(opts.height)!="undefined"?opts.height:100;//缩微图高度
				var form=typeof(opts.form)!="undefined"?opts.form:the.prev('input');//表单名称
				var runtimeOrder=typeof(opts.runtimeOrder)!="undefined"?opts.runtimeOrder:'html5,flash';//是否启用flash
				var sendAsBinary=typeof(opts.sendAsBinary)!="undefined"?opts.sendAsBinary:false;//是否启用二进制上传
				var accept_img={title: 'Images',extensions: 'gif,jpg,jpeg,bmp,png',mimeTypes: 'image/jpg,image/jpeg,image/png'};
				var accept_audio={title: 'Audio',extensions: 'mp3',mimeTypes: 'audio/*'};
				var accept_video={title: 'Video',extensions: 'mp4,avi',mimeTypes: 'video/*'};
				var accept_application={title: 'Video',extensions: 'rar,zip,doc,xls',mimeTypes: 'application/*'};
				if(opts.accept=='audio'){
					var accept=accept_audio;
				}else if(opts.accept=='video'){
					var accept=accept_video;
				}else if(opts.accept=='application'){
					var accept=accept_application;
				}else if(opts.accept=='image'){
					var accept=accept_img;
				}else{
					var accept='';
				}
				
				// 初始化Web Uploader
				var uploader = WebUploader.create({
					auto: auto,
					sendAsBinary:sendAsBinary,
					fileNumLimit:1,
					swf: swf,
					server: server,
					pick: {
						id:pick,
						multiple:false
					},
					accept: accept,
					compress:{
						quality:100	
					},
					runtimeOrder:runtimeOrder
				});
			
				uploader.on("uploadStart", function(file){
			        jQuery.ajax({
			            async:false,
			            type: 'get',
			            url: tokenUrl,
			            success: function (res) {
			                token = res.uptoken;
			                if(hash) {
			                    uploader.options.formData = {
			                        token : token,
			                    }
			                } else {
			                    uploader.options.formData = {
			                        token : token,
			                        key: file.name
			                    }
			                }
			            }
			        });
			    });
				
				uploader.on( 'fileQueued', function( file ) {
					if (typeof(opts.fileQueued_callback)!="undefined") {
						opts.fileQueued_callback(file);
					}
				});
			
				uploader.on( 'uploadProgress', function( file, percentage ) {
					if (typeof(opts.uploadProgress_callback)!="undefined") {
						opts.uploadProgress_callback(file,percentage);
					}
				});
				
				uploader.on("uploadSuccess", function(file, res) {
					if (typeof(opts.uploadSuccess_callback)!="undefined") {
						opts.uploadSuccess_callback(file, res);
					}
			    });
				
				uploader.on( 'uploadError', function( file ) {
					if (typeof(opts.uploadError_callback)!="undefined") {
						opts.uploadError_callback(file);
					}
				});
				
				uploader.on( 'uploadComplete', function( file ) {
					uploader.reset();
					console.log(file);
					if (typeof(opts.uploadComplete_callback)!="undefined") {
						opts.uploadComplete_callback(file);
					}
				});
				
				
			}
			
			/**
			 * 文件更换回调
			 */
			function file_update_callbak(file, res){
				
				var index1=file.name.lastIndexOf(".");
				var index2=file.name.length;
				scope.file_the_suffix=file.name.substring(index1+1,index2);
				scope.file_the_name=file.name.substring(0,index1);
				
				scope.file_update_key=res.key;
				scope.file_update_qiniu='QINIU_FILE1';
				scope.file_update_size=file.size;
				scope.file_update_type=file.type;
				scope.file_the_suffix=file.ext;
				scope.$apply();
			}
			
			function file_update_uploadProgress_callback(file, percentage ){
				scope.file_update_percentage=Math.floor(percentage*100)+'%';
				scope.$apply();
			}
		</script>
		
	</body>

</html>