front-download.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {template 'common/header'}
  2. <div class="front-download">
  3. <ul class="we7-page-tab">
  4. <li class="{if $type == 'apk'}active{/if}"><a
  5. href="{php echo url('phoneapp/front-download', array('version_id' => $version_id, 'type' => 'apk'))}">安卓APP下载</a></li>
  6. <li class="{if $type == 'ipa'}active{/if}"><a
  7. href="{php echo url('phoneapp/front-download', array('version_id' => $version_id, 'type' => 'ipa'))}">苹果APP下载</a></li>
  8. </ul>
  9. {if $type == 'apk'}
  10. <div class="alert we7-page-alert">
  11. <p><i class="wi wi-info-sign"></i>以360市场为例,下载“360加固保”对下载的文件进行加固。地址:<a href="http://jiagu.360.cn/" target="_blank">http://jiagu.360.cn/</a> </p>
  12. <p><i class="wi wi-info-sign"></i>加固后,请对apk文件重新配置签名。<a href="javascript:;" class="showSetting">配置APK</a></p>
  13. </div>
  14. {/if}
  15. <div class="app-down-box">
  16. <img src="{$module['logo']}" alt="{$module['title']}" class="logo">
  17. <div class="title">{if $type == 'ipa'}苹果{else}安卓{/if}APP应用{$type}包</div>
  18. <a class="btn btn-primary"
  19. href="{php echo url('phoneapp/front-download/getpackage', array('version_id' => $version_id, 'type' => $type))}">
  20. 立即下载
  21. </a>
  22. </div>
  23. <div class="modal apk-select-modal" id="ApkSelect">
  24. <div class="modal-dialog we7-modal-dialog">
  25. <div class="modal-content">
  26. <div class="modal-header">
  27. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  28. <h3 class="modal-title">配置APK</h3>
  29. </div>
  30. <div class="modal-body we7-form">
  31. <div class="alert we7-page-alert">
  32. <i class="wi wi-info-sign"></i> 上传加固后的apk,配置签名后重新下载apk。
  33. </div>
  34. <div class="form-group">
  35. <label for="" class="control-label col-sm-3">上传APK文件</label>
  36. <div class="form-controls col-sm-8">
  37. <div class="input-group">
  38. <input type="text" readonly name="cname" id="apkName" class="form-control " autocomplete="off" />
  39. <div class="input-group-addon">
  40. <input type="file" name="apk" id="apk" accept=".apk" class="form-control hidden" autocomplete="off" />
  41. <label for="apk" >选择文件</label>
  42. </div>
  43. </div>
  44. <span class="help-block"></span>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="modal-footer">
  49. <button class="btn btn-primary js-ApkSelect" disabled>下载配置APK</button>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <script>
  56. var siteinfo = '{php echo json_encode($siteinfo)}';
  57. $('.showSetting').click(function() {
  58. $('#ApkSelect').modal('show')
  59. })
  60. $('#apk').change(function(event) {
  61. var file = event.target.files[0];
  62. if (file) {
  63. $('#apkName').val(file.name);
  64. $('.js-ApkSelect').attr('disabled', false)
  65. }
  66. })
  67. $('.js-ApkSelect').click(function(event) {
  68. var file = document.getElementById("apk").files[0];
  69. if (file) {
  70. require(['jszip', 'fileSaver'], function(JSZip, fileSaver){
  71. JSZip.loadAsync(file).then(function(zip){
  72. console.log(zip.comment);
  73. zip.generateAsync({comment: siteinfo,type:"blob"})
  74. .then(function (blob) {
  75. saveAs(blob, "配置.apk");
  76. });
  77. });
  78. });
  79. }
  80. })
  81. </script>
  82. {template 'common/footer'}