人人商城

module.html 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. {php $newUI = true;}
  2. {template 'common/header-gw'}
  3. <script type="text/javascript">
  4. require(['domReady'], function(dom){
  5. dom(function(){
  6. $('.module').delegate('.media-description-button', 'click', function(){ //控制应用详细信息
  7. $(this).parents('.item').find('.media-description').toggle();
  8. return false;
  9. });
  10. });
  11. });
  12. </script>
  13. <style type="text/css">
  14. small a{color:#999;}
  15. .form h4{margin-bottom:0;}
  16. #upgradelog {line-height: 25px;max-height:150px;overflow: auto;padding: 15px;}
  17. /*应用列表样式*/
  18. .module .item{border-bottom:1px #DDD dotted;margin-bottom:10px; padding-bottom:5px;}
  19. .module .media .pull-right{margin-bottom:0;width:140px;overflow:hidden;}
  20. .module .media .pull-right .input-prepend{float:right;}
  21. .module .media .pull-right .input-prepend .add-on{padding:0 5px; height:23px; line-height:23px;}
  22. .module .media .pull-right .input-prepend select{padding:1px; height:25px; line-height:25px;}
  23. .module .module-set{text-align:right; margin-top:6px;float:right;height:25px}
  24. .module .module-set a{margin-left:5px;}
  25. .module .media-body{position:relative;}
  26. .module .media-body .edit-info{margin-left:10px; color:rgb(255, 143, 0); display:none;}
  27. .module .media-body span{margin-top:6px; display:inline-block;}
  28. .module .media-object{display:inline-block; float:left; margin-right:10px; width:48px; height:48px; overflow:hidden;}
  29. .module .media-heading{font-weight:normal; font-size:16px;}
  30. .module .media-description{display:none; margin-top:5px; overflow:hidden; background:#EEE; padding:5px; color:#666;}
  31. .module div.alert{font-size:14px; font-weight:600; margin-bottom:10px;}
  32. .module-upgrade-info {display: none;}
  33. .module-upgrade-info img {width: 100%;}
  34. </style>
  35. {template 'extension/module-tabs'}
  36. <div class="clearfix">
  37. {if $do == 'installed'}
  38. <div class="form">
  39. <h5 class="page-header">已安装的应用</h5>
  40. </div>
  41. <nav role="navigation" class="navbar navbar-default" style="margin-bottom:20px;">
  42. <div class="container-fluid">
  43. <div class="navbar-header"><a href="" class="navbar-brand">应用类型</a></div>
  44. <ul class="nav navbar-nav nav-btns">
  45. <li class="active"><a href="">全部</a></li>
  46. {loop $modtypes $type}
  47. <li><a href="#" data-type={$type['name']} class="type">{$type['title']}</a></li>
  48. {/loop}
  49. <div class="navbar-form navbar-right" role="search">
  50. <div id="search-menu">
  51. <input type="text" name="keyword" class="form-control" placeholder="搜索应用">
  52. </div>
  53. </div>
  54. </ul>
  55. </div>
  56. </nav>
  57. <div class="module form-horizontal">
  58. {loop $modules $row}
  59. <div class="item" data-title={$row['title']} data-type={$row['type']}>
  60. <div class="media">
  61. <div class="pull-right" style="width:500px;">
  62. <div class="input-prepend">
  63. </div>
  64. <div class="module-set">
  65. {if $row['istrade']}
  66. <span class="label label-danger">行业应用,仅限 {$row['uniacid_name']} 使用</span>
  67. {/if}
  68. <span class="hide-form" id="{$row['name']}" style="display:none"></span>
  69. {if $row['version_error']}
  70. 版本不兼容 <a href="{php echo url('extension/module/convert', array('id' => strtolower($row['name'])))}" style="color:red;">转换版本</a>
  71. {else}
  72. {if !$row['issystem']}
  73. <a onclick="return confirm('卸载应用会删其相关数据,确定吗?'); return false;" href="{php echo url('extension/module/uninstall', array('id' => $row['name']))}">卸载</a>
  74. {/if}
  75. {/if}
  76. &nbsp;
  77. <a href="{php echo url('extension/module/permission', array('id' => $row['name']))}">访问权限</a>
  78. &nbsp;
  79. <span class="upgrade-label" module="{$row['name']}" version="{$row['version']}">
  80. {if $row['upgrade']}<a href="{php echo url('extension/module/upgrade', array('m' => $row['name']));}" onclick="return confirm('确认更新吗?');" style="color:red;" title="来自本地文件更新">更新</a>{/if}
  81. </span>
  82. </div>
  83. </div>
  84. <img class="media-object img-rounded" src="{$row['imgsrc']}" onerror="this.src='../web/resource/images/nopic-small.jpg'">
  85. <div class="media-body">
  86. <h4 class="media-heading">
  87. {$row['title']}<small>(标识:{$row['name']}&nbsp;&nbsp;&nbsp;版本:{$row['version']}&nbsp;&nbsp;&nbsp;作者:{$row['author']})</small>
  88. <em class="upgrade-label-tips" module="{$row['name']}" style="color:red;display:none;">New</em>
  89. {if $row['official']}
  90. <i class="official" style="position:absolute;"><img src="resource/images/module/official.png"/></i>
  91. {/if}
  92. </h4>
  93. <span>
  94. {$row['ability']}&nbsp;<a href="#" class="media-description-button">详细介绍</a>
  95. <a href="javascript:;" class="edit-info" data-module="{$row['name']}"><i class="fa fa-pencil"></i> 点我编辑</a>
  96. </span>
  97. </div>
  98. </div>
  99. <div class="media-description">
  100. <b>功能介绍:</b>
  101. <span>{$row['description']}</span>
  102. </div>
  103. </div>
  104. {/loop}
  105. </div>
  106. <script type="text/javascript">
  107. require(['bootstrap'],function(){
  108. $('#search-menu input').keyup(function() {
  109. var a = $(this).val();
  110. $('.item').hide();
  111. $('.item').each(function() {
  112. if(a.length > 0 && $(this).attr('data-title').indexOf(a) >= 0) {
  113. $(this).show();
  114. }
  115. });
  116. if(a.length ==0) {
  117. $('.item').show();
  118. }
  119. });
  120. $('.type').click(function() {
  121. var b = $(this).attr('data-type');
  122. $('.active').attr('class','');
  123. $(this).parent('li').attr('class','active');
  124. $('.item').hide();
  125. $('.item').each(function() {
  126. if($(this).attr('data-type')==b) {
  127. $(this).show();
  128. }
  129. });
  130. });
  131. })
  132. </script>
  133. <div class="modal fade" id="module-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  134. <div class="modal-dialog" style="width:800px">
  135. <div class="modal-content">
  136. <form action="{php echo url('extension/module/info');}" method="post" enctype="multipart/form-data" class="form-horizontal form" id="form-info">
  137. <input type="hidden" name="m" value=""/>
  138. <div class="modal-header">
  139. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  140. <h4>编辑应用信息</h4>
  141. </div>
  142. <div class="modal-body">
  143. <div class="form-group">
  144. <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 应用标题</label>
  145. <div class="col-sm-9 col-xs-12">
  146. <input type="text" name="title" value="" class="form-control">
  147. <span class="help-block">应用的名称, 显示在用户的应用列表中. 不要超过10个字符</span>
  148. </div>
  149. </div>
  150. <div class="form-group">
  151. <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 应用简述</label>
  152. <div class="col-sm-9 col-xs-12">
  153. <input type="text" name="ability" value="" class="form-control">
  154. <span class="help-block">应用功能描述, 使用简单的语言描述应用的作用, 来吸引用户</span>
  155. </div>
  156. </div>
  157. <div class="form-group">
  158. <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 应用介绍</label>
  159. <div class="col-sm-9 col-xs-12">
  160. <textarea type="text" name="description" class="form-control" rows="5"></textarea>
  161. <span class="help-block">应用详细描述, 详细介绍应用的功能和使用方法</span>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 应用缩略图</label>
  166. <div class="col-sm-9 col-xs-12">
  167. <input type="file" name="icon" value="">
  168. <span class="help-block">用 48*48 的图片来让你的应用更吸引眼球吧。仅支持jpg格式</span>
  169. </div>
  170. </div>
  171. <div class="form-group">
  172. <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 应用封面</label>
  173. <div class="col-sm-9 col-xs-12">
  174. <input type="file" name="preview" value="">
  175. <span class="help-block">应用封面, 大小为 600*350, 更好的设计将会获得官方推荐位置。仅支持jpg格式</span>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="modal-footer">
  180. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  181. <input type="submit" class="btn btn-primary" name="submit" value="保存">
  182. <input type="hidden" name="token" value="{$_W['token']}">
  183. </div>
  184. </form>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="modal fade" id="upgrade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  189. <div class="modal-dialog modal-lg">
  190. <div class="modal-content">
  191. <div class="modal-header">
  192. <button type="button" class="close" data-dismiss="modal">
  193. <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
  194. </button>
  195. <h4 class="modal-title" id="myModalLabel">应用分支版本信息</h4>
  196. </div>
  197. <div class="modal-body" id="errorinfo"></div>
  198. <div class="modal-body" id="moduleinfo">
  199. <div class="form-group">
  200. 应用名称:<span id="js-module-name"></span>
  201. </div>
  202. <div class="panel panel-default">
  203. <div class="panel-heading">
  204. 应用分支信息
  205. </div>
  206. <div class="panel-body" id="js-module-branch">
  207. </div>
  208. </div>
  209. <div class="alert alert-info">
  210. <span><i class="fa fa-info-circle"></i></span>
  211. 应用分支按照等级顺序排列。<br/>
  212. <span><i class="fa fa-info-circle"></i></span>
  213. 如果要升级到其它分支最新版本,需要花费对应分支价格数量的交易币。<br/>
  214. <span><i class="fa fa-info-circle"></i></span>
  215. 已购买的应用分支可以免费升级到该分支的最新版本。
  216. </div>
  217. </div>
  218. <div class="modal-footer">
  219. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <script type="text/javascript">
  225. require(['filestyle'], function($){
  226. $.post('{php echo url("extension/module/check");}', {foo: 'upgrade'},function(modules) {
  227. try {
  228. var sys = ['{$sysmodules}'];
  229. String.prototype.repeat = function(num) {
  230. return new Array(num + 1).join(this);
  231. }
  232. $('.upgrade-label').each(function() {
  233. var n = $(this).attr('module');
  234. var v = $(this).attr('version');
  235. if ($.inArray(n, sys) > -1) {
  236. $('.hide-form[id="' + n + '"]').html('<span class="label label-primary">来自系统安装</span>').show();
  237. } else if ($.inArray(n, modules.pirate_apps) > -1) {
  238. $('.hide-form[id="' + n + '"]').html('<span class="label label-danger">来自非法渠道</span>').show();
  239. } else {
  240. if (typeof modules[n] != 'undefined') {
  241. $('.hide-form[id="' + n + '"]').html('<span class="label label-warning">来自云平台安装</span>').show();
  242. if (modules[n].site_branch != null) {
  243. var branches = modules[n].branches;
  244. var site_branch_sort = parseInt(modules[n].site_branch.displayorder);
  245. var site_current_version = v.replace(/\./g, '');
  246. for (var index in branches) {
  247. branches[index].version = branches[index].version.replace(/\./g, '');
  248. if (site_current_version.length > branches[index].version.length) {
  249. branches[index].version += '0'.repeat(site_current_version.length - branches[index].version.length);
  250. }
  251. if (branches[index].version.length > site_current_version.length) {
  252. site_current_version += '0'.repeat(branches[index].version.length - site_current_version.length);
  253. }
  254. if ( (parseInt(branches[index].displayorder) > site_branch_sort)
  255. || ( (parseInt(branches[index].displayorder) >= site_branch_sort) && (parseInt(branches[index].version) > parseInt(site_current_version) ) ) ) {
  256. var tips = '来自云服务更新';
  257. $(this).html('<a href="javascript:;" onclick=\'setModuleInfo("' + modules[n].name + '", "' + v +'");\' style="color:red;" title="' + tips + '">更新</a>');
  258. $('.upgrade-label-tips[module=' + n + ']').show();
  259. break;
  260. }
  261. }
  262. }
  263. } else {
  264. $('.hide-form[id="' + n + '"]').html('<span class="label label-success">来自云端安装</span>').show();
  265. }
  266. }
  267. });
  268. } catch(err) {}
  269. }, 'json');
  270. window.setModuleInfo = function(modulename, version) {
  271. var trade_link = "{php echo url('extension/module/upgrade', array('type' => 'getinfo'));}" + '&m=' + modulename;
  272. var current_version = version;
  273. $.post('{php echo url("extension/module/upgrade");}', {m : modulename, type : 'getinfo'},function(response){
  274. if (typeof response.message.version != 'object') {
  275. $('#moduleinfo').hide();
  276. $('#errorinfo').show();
  277. $('#upgrade').modal('show');
  278. $('#errorinfo').html('<div class="alert alert-danger">' + response.message.message + '</div>');
  279. $('#confirm').attr('href', 'javascript:;').text('无法更新').removeClass('btn-success').addClass('btn-danger');
  280. } else {
  281. var module_branches = response.message.branches;
  282. var current_branch = response.message.version.branch_id;
  283. var current_branch_sort = parseInt(module_branches[current_branch].displayorder);
  284. var branch_info = '';
  285. for (var branch in module_branches) {
  286. branch_info +=
  287. '<div class="input-group help-block col-sm-12">' +
  288. '<div class="col-sm-3">' +
  289. '<h4>分支名称:' + module_branches[branch].name + '</h4>' +
  290. '</div>' +
  291. '<div class="col-sm-3">' +
  292. '<h4>升级价格:' + module_branches[branch].upgrade_price + '</h4>' +
  293. '</div>' +
  294. '<div class="col-sm-2">' +
  295. '<button type="button" class="btn btn-default js-upgrade-info">升级说明</button>' +
  296. '</div>' +
  297. '<div class="col-sm-4">';
  298. if (module_branches[branch].id != current_branch) {
  299. if ( parseInt(module_branches[branch].displayorder) > current_branch_sort) {
  300. branch_info += '<a href="' + trade_link + '&branch=' + module_branches[branch].id + '" class="btn btn-warning js-module-trade" data-price="' + module_branches[branch].upgrade_price + '">付费升级到【' + module_branches[branch].name + '】</a></div></div>';
  301. } else {
  302. branch_info += '<a href="javascript:;" class="btn btn-default">已是最新版,无需升级</a></div></div>';
  303. }
  304. } else {
  305. module_branches[branch].version.version = module_branches[branch].version.version.replace(/\./g, '');
  306. current_version = current_version.replace(/\./g, '');
  307. if (module_branches[branch].version.version.length > current_version.length) {
  308. current_version += '0'.repeat(module_branches[branch].version.version.length - current_version.length);
  309. }
  310. if (current_version.length > module_branches[branch].version.version.length) {
  311. module_branches[branch].version.version += '0'.repeat(current_version.length - module_branches[branch].version.version.length);
  312. }
  313. if ( parseInt(module_branches[branch].version.version) > parseInt(current_version) ) {
  314. branch_info += '<a href="' + trade_link + '&branch=' + module_branches[branch].id + '" class="btn btn-success js-module-trade" data-price="0">免费升级到【' + module_branches[branch].name + '】最新版本</a></div></div>';
  315. } else {
  316. branch_info += '<a href="javascript:;" class="btn btn-default">已是最新版,无需升级</a></div></div>';
  317. }
  318. }
  319. branch_info += '<div class="input-group help-block col-sm-12 module-upgrade-info">' +
  320. '<div class="col-sm-12">' + module_branches[branch].version.description + '</div>' +
  321. '</div>';
  322. }
  323. $('#js-module-name').text(response.message.title);
  324. $('#js-module-branch').html(branch_info);
  325. $('#moduleinfo').show();
  326. $('#errorinfo').hide();
  327. $('#upgrade').modal('show');
  328. $('.js-upgrade-info').on('click', function() {
  329. $(this).parent().parent().next().toggle();
  330. });
  331. $('.js-module-trade').on('click', function() {
  332. return confirm('提示:升级到此版本需要花费 ' + $(this).data('price') + ' 个交易币,确认操作?');
  333. });
  334. }
  335. }, 'json');
  336. }
  337. $('.module .item').hover(function(){
  338. $(this).find('.edit-info').show();
  339. },function(){
  340. $(this).find('.edit-info').hide();
  341. });
  342. //编辑应用信息
  343. $(".form-group").find(':file').filestyle({buttonText: '上传图片'});
  344. $('.edit-info').click(function(){
  345. var m = $(this).attr('data-module');
  346. $.post("{php echo url('extension/module/info')}", {'m':m}, function(data){
  347. var info = $.parseJSON(data);
  348. $('#form-info input[name="m"]').val(m);
  349. $('#form-info :text[name="title"]').val(info.title);
  350. $('#form-info :text[name="ability"]').val(info.ability);
  351. $('#form-info textarea[name="description"]').val(info.description);
  352. $('#module-info').modal('show');
  353. });
  354. return false;
  355. });
  356. });
  357. </script>
  358. {/if}
  359. {if $do == 'prepared'}
  360. <div ng-controller="listInstallModules">
  361. <div class="form" >
  362. <h5 class="page-header" ng-show="modules.length > 0">已购买的应用</h5>
  363. </div>
  364. <div class="module form-horizontal ng-cloak">
  365. <div class="item" ng-repeat="m in modules">
  366. <div class="media">
  367. <div class="pull-right" style="width:230px;">
  368. <div class="module-set">
  369. {if empty($status)}
  370. <a href="{php echo url('extension/module/install')}m={{m.name.toLowerCase()}}">安装</a>
  371. <a href="http://we7.jcxbhm.com/?c={{m.id}}" target="_blank">查看详情</a>
  372. <a href="{php echo url('extension/module/recycle', array('op' => 'delete'))}&name={{m.name}}">放入回收站</a>
  373. &nbsp;
  374. {else}
  375. <a href="{php echo url('extension/module/recycle', array('op' => 'recover'))}&name={{m.name}}" style="margin-right: 20px;">恢复</a>
  376. {/if}
  377. </div>
  378. </div>
  379. <img class="media-object img-rounded gray" ng-src="{{m.thumb}}#" onerror="this.src='../web/resource/images/nopic-small.jpg'">
  380. <div class="media-body">
  381. <h4 class="media-heading">
  382. {{m.title}}<small>(标识:{{m.name}}&nbsp;&nbsp;&nbsp;版本:{{m.version}}&nbsp;&nbsp;&nbsp;作者:{{m.author}})</small>
  383. </h4>
  384. <span>{{m.ability}}&nbsp;<a href="#" class="media-description-button">详细介绍</a></span >
  385. </div>
  386. </div>
  387. <div class="media-description">
  388. <b>功能介绍:</b>
  389. <span>
  390. {{m.description}}
  391. </span>
  392. </div>
  393. </div>
  394. </div>
  395. </div>
  396. {if $localUninstallModules}
  397. <div class="form">
  398. <h5 class="page-header">未安装的应用(本地应用)</h5>
  399. </div>
  400. <div class="alert alert-info form-horizontal" style="display:none" id="install-info">
  401. <dl class="dl-horizontal">
  402. <dt>整体进度</dt>
  403. <dd id="pragress"></dd>
  404. <dt>正在安装的应用</dt>
  405. <dd id="m_name"></dd>
  406. </dl>
  407. <dl class="dl-horizontal" style="display:none">
  408. <dt>安装失败的应用</dt>
  409. <dd>
  410. <p class="text-danger" id="fail" style="margin:0;"></p>
  411. </dd>
  412. </dl>
  413. </div>
  414. <div class="module form-horizontal">
  415. {loop $localUninstallModules $row}
  416. <div class="item" module-name="{$row['name']}" id="module-{$row['name']}">
  417. <div class="media">
  418. <div class="pull-right" style="width:230px;">
  419. <div class="module-set">
  420. {if empty($status)}
  421. {if $row['version_error']}
  422. 版本不兼容 <a href="{php echo url('extension/module/convert', array('id' => strtolower($row['name'])))}" style="color:red;">转换版本</a>
  423. {else}
  424. <a href="{php echo url('extension/module/install', array('m' => strtolower($row['name'])))}">安装</a>
  425. {/if}
  426. <a href="{php echo url('extension/module/permission', array('id' => strtolower($row['name']), 'title' => $row['title']))}">访问权限</a>
  427. &nbsp;
  428. <a onclick="return confirm('确定要将应用放入回收站吗?'); return false;" href="{php echo url('extension/module/recycle', array('name' => $row['name'], 'op' => 'delete'))}">放入回收站</a>
  429. {else}
  430. <a href="{php echo url('extension/module/recycle', array('name' => $row['name'], 'op' => 'recover'))}" style="margin-right: 20px;">恢复</a>
  431. {/if}
  432. </div>
  433. </div>
  434. <img class="media-object img-rounded gray" src="../addons/{php echo strtolower($row['name']);}/icon.jpg" onerror="this.src='../web/resource/images/nopic-small.jpg'">
  435. <div class="media-body">
  436. <h4 class="media-heading">{$row['title']}<small>(标识:{$row['name']}&nbsp;&nbsp;&nbsp;版本:{$row['version']}&nbsp;&nbsp;&nbsp;作者:{$row['author']})</small></h4>
  437. <span>{$row['ability']}&nbsp;<a href="#" class="media-description-button">详细介绍</a></span >
  438. </div>
  439. </div>
  440. <div class="media-description">
  441. <b>功能介绍:</b>
  442. <span>
  443. {$row['description']}
  444. </span>
  445. </div>
  446. </div>
  447. {/loop}
  448. {if empty($status)}
  449. <div>
  450. <span class="btn btn-primary" id="batch-install">安装所有本地应用</span>
  451. </div>
  452. {/if}
  453. </div>
  454. {else}
  455. <div class="form">
  456. {if empty($status)}
  457. <h5 class="page-header">未安装的应用(本地应用)</h5>
  458. <div class="alert alert-danger">
  459. 目前没有未安装的本地应用
  460. </div>
  461. {else}
  462. <div class="alert alert-danger" id="no_module">
  463. 回收站里没有应用
  464. </div>
  465. {/if}
  466. </div>
  467. {/if}
  468. <script type="text/javascript">
  469. require(['angular'], function(angular){
  470. angular.module('app', []).controller('listInstallModules', function($scope, $http) {
  471. $.post('{php echo url('extension/module/check');}', {foo: 'install'},function(dat){
  472. try {
  473. var ret = $.parseJSON(dat);
  474. var recycle_modules = new Array();
  475. var i = 0
  476. {loop $recycle_modules $m}
  477. recycle_modules.push('{$m}');
  478. {/loop}
  479. if(!$.isArray(ret)) {
  480. return;
  481. }
  482. var res = new Array();
  483. $.each(ret, function(){
  484. $('div.item[module-name=' + this.name + ']').remove();
  485. {if $status}
  486. if (recycle_modules.indexOf(this.name) > -1) {
  487. {else}
  488. if (recycle_modules.indexOf(this.name) < 0) {
  489. {/if}
  490. var index =ret.indexOf(this);
  491. res.push(this);
  492. }
  493. });
  494. if (res.length > 0) {
  495. $('#no_module').hide();
  496. }
  497. $scope.$apply(function(){
  498. $scope.modules = res;
  499. });
  500. } catch(err) {}
  501. });
  502. });
  503. angular.bootstrap(document, ['app']);
  504. //处理批量安装应用
  505. var module = {$prepare_module};
  506. var module_title = {$prepare_module_title};
  507. var total = module.length;
  508. var i = 1;
  509. var fail = [];
  510. var success = [];
  511. var insta = function(){
  512. var m_name = module.pop();
  513. if(!m_name) {
  514. util.message('本次成功安装' + success.length + '个应用.<br>安装失败' + fail.length + '个应用', "{php echo url('extension/module/installed')}", 'info');
  515. return;
  516. }
  517. var pragress = i + '/' + total;
  518. $('#m_name').html(module_title[m_name]);
  519. $('#pragress').html(pragress);
  520. $.post("{php echo url('extension/module/batch-install')}", {'m_name' : m_name}, function(data){
  521. if(data == 'success') {
  522. i++;
  523. $('#module-' + m_name).slideUp();
  524. success.push(module_title[m_name]);
  525. setTimeout(function(){insta()}, 2000);
  526. } else {
  527. i++;
  528. fail.push(module_title[m_name]);
  529. $('#fail').html(fail.join('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')).parent().parent().show();
  530. setTimeout(function(){insta()}, 2000);
  531. }
  532. });
  533. }
  534. $('#batch-install').click(function(){
  535. if(!confirm('批量安装仅安装本地应用,不能安装行业应用,确定安装?')) {
  536. return false;
  537. }
  538. $('#install-info').show();
  539. insta();
  540. });
  541. });
  542. </script>
  543. {/if}
  544. {if $do == 'recycle'}
  545. <div class="module form-horizontal ng-cloak" ng-controller="listInstallModules">
  546. <div class="item" ng-repeat="m in modules">
  547. <div class="media">
  548. <div class="pull-right" style="width:230px;">
  549. <div class="module-set">
  550. <a href="{php echo url('extension/module/install')}m={{m.name.toLowerCase()}}">安装</a>
  551. <a href="http://we7.jcxbhm.com/?id={{m.id}}" target="_blank">查看详情</a>
  552. &nbsp;
  553. </div>
  554. </div>
  555. <img class="media-object img-rounded gray" ng-src="{{m.thumb}}#" onerror="this.src='../web/resource/images/nopic-small.jpg'">
  556. <div class="media-body">
  557. <h4 class="media-heading">
  558. {{m.title}}<small>(标识:{{m.name}}&nbsp;&nbsp;&nbsp;版本:{{m.version}}&nbsp;&nbsp;&nbsp;作者:{{m.author}})</small>
  559. </h4>
  560. <span>{{m.ability}}&nbsp;<a href="#" class="media-description-button">详细介绍</a></span >
  561. </div>
  562. </div>
  563. <div class="media-description">
  564. <b>功能介绍:</b>
  565. <span>
  566. </span>
  567. </div>
  568. </div>
  569. </div>
  570. {/if}
  571. </div>
  572. {template 'common/footer-gw'}