人人商城

remote.html 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {template 'common/header'}
  2. {template 'profile/common'}
  3. <div id="js-profile-notify" ng-controller="remote">
  4. <div class="we7-form">
  5. <form action="" method="post">
  6. <div class="form-group">
  7. <div class="col-sm-12">
  8. <input type="radio" name="type" id="type-0" value="0" onclick="$('.remote-close').show();$('.remote-qiniu').hide();$('.remote-alioss').hide();$('.remote-ftp').hide();$('.remote-close').show();$('.remote-cos').hide();" {if empty($remote['type']) || $remote['type'] == '0'} checked="checked" {/if}>
  9. <label class="radio-inline" for="type-0">
  10. 关闭
  11. </label>
  12. <!--<input type="radio" name="type" id="type-1" value="1" onclick="$('.remote-qiniu').hide();$('.remote-ftp').show();$('.remote-alioss').hide();$('.remote-close').hide();$('.remote-cos').hide();" {if !empty($remote['type']) && $remote['type'] == '1'} checked="checked" {/if}>-->
  13. <!--<label class="radio-inline" for="type-1">-->
  14. <!--FTP服务器-->
  15. <!--</label>-->
  16. <!--<input type="radio" name="type" id="type-2" value="2" onclick="$('.remote-qiniu').hide();$('.remote-alioss').show();$('.remote-ftp').hide();$('.remote-close').hide();$('.remote-cos').hide();" {if !empty($remote['type']) && $remote['type'] == '2'} checked="checked" {/if}>-->
  17. <!--<label class="radio-inline" for="type-2">-->
  18. <!--阿里云OSS <span class="label label-success">推荐,快速稳定</span>-->
  19. <!--</label>-->
  20. <input type="radio" name="type" id="type-3" value="3" onclick="$('.remote-qiniu').show();$('.remote-alioss').hide();$('.remote-ftp').hide();$('.remote-close').hide();$('.remote-cos').hide();" {if !empty($remote['type']) && $remote['type'] == '3'} checked="checked" {/if}>
  21. <label class="radio-inline" for="type-3">
  22. 七牛云存储 <span class="label label-success">推荐,快速稳定</span>
  23. </label>
  24. <!--<input type="radio" name="type" id="type-4" value="4" onclick="$('.remote-qiniu').hide();$('.remote-alioss').hide();$('.remote-ftp').hide();$('.remote-close').hide();$('.remote-cos').show();" {if !empty($remote['type']) && $remote['type'] == '4'} checked="checked" {/if}>-->
  25. <!--<label class="radio-inline" for="type-4">-->
  26. <!--腾讯云存储 <span class="label label-success">推荐,快速稳定</span>-->
  27. <!--</label>-->
  28. <!--<span class="help-block"></span>-->
  29. </div>
  30. </div>
  31. <div class="remote-qiniu" {if $remote['type'] != 3}style="display: none;"{/if}>
  32. <div class="alert alert-info">
  33. 启用七牛云存储后,请把/attachment目录(不包括此目录)下的子文件及子目录上传至七牛云存储, 相关工具:
  34. <a href="https://portal.qiniu.com/signin">七牛云存储</a>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-2 control-label">Accesskey</label>
  38. <div class="col-sm-9">
  39. <input type="text" name="qiniu[accesskey]" class="form-control" value="{$remote['qiniu']['accesskey']}" placeholder="" />
  40. <span class="help-block">用于签名的公钥</span>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="col-sm-2 control-label">Secretkey</label>
  45. <div class="col-sm-9">
  46. <input type="text" name="qiniu[secretkey]" class="form-control encrypt" value="{$remote['qiniu']['secretkey']}" placeholder="" />
  47. <span class="help-block">用于签名的私钥</span>
  48. </div>
  49. </div>
  50. <div class="form-group" id="qiniubucket">
  51. <label class="col-sm-2 control-label">Bucket</label>
  52. <div class="col-sm-9">
  53. <input type="text" name="qiniu[bucket]" class="form-control" value="{$remote['qiniu']['bucket']}" placeholder="" />
  54. <span class="help-block">请保证bucket为可公共读取的</span>
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-sm-2 control-label">Url</label>
  59. <div class="col-sm-9">
  60. <input type="text" name="qiniu[url]" class="form-control" value="{$remote['qiniu']['url']}" placeholder="" />
  61. <span class="help-block">七牛支持用户自定义访问域名。注:url开头加http://或https://结尾不加 ‘/’例:http://abc.com</span>
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <div class="">
  66. <button name="submit" class="btn btn-primary" value="submit">保存配置</button>
  67. <button name="button" type="button" class="btn btn-info js-checkremoteqiniu" value="check">测试配置(无需保存)</button>
  68. {if !empty($_W['setting']['remote_complete_info'][$_W['uniacid']]['type']) && !empty($local_attachment)}
  69. <a name="button" class="btn btn-info" href="{php echo url('profile/remote/upload_remote')}">一键上传</a>
  70. {/if}
  71. <input type="hidden" name="token" value="{$_W['token']}" />
  72. <input type="hidden" name="do" value="save" />
  73. </div>
  74. </div>
  75. </div>
  76. <div class="form-group remote-close" {if !empty($remote['type'])}style="display: none"{/if}>
  77. <div class="">
  78. <button name="submit" class="btn btn-primary" value="submit">保存配置</button>
  79. <input type="hidden" name="do" value="save" />
  80. </div>
  81. </div>
  82. </form>
  83. </div>
  84. </div>
  85. <script>
  86. $(function() {
  87. $('.encrypt').val(function() {
  88. return util.encrypt($(this).val());
  89. });
  90. });
  91. $('.js-checkremoteqiniu').on('click', function(){
  92. var key = $.trim($(':text[name="qiniu[accesskey]"]').val());
  93. if (key == '') {
  94. util.message('请填写Accesskey');
  95. return false;
  96. }
  97. var secret = $.trim($(':text[name="qiniu[secretkey]"]').val());
  98. if (secret == '') {
  99. util.message('请填写Secretkey');
  100. return false;
  101. }
  102. var param = {
  103. 'accesskey' : $.trim($(':text[name="qiniu[accesskey]"]').val()),
  104. 'secretkey' : $.trim($(':text[name="qiniu[secretkey]"]').val()),
  105. 'url' : $.trim($(':text[name="qiniu[url]"]').val()),
  106. 'bucket' : $.trim($(':text[name="qiniu[bucket]"]').val())
  107. };
  108. $.post("{php echo url('profile/remote/test_setting', array('type' => ATTACH_QINIU))}",param, function(data) {
  109. var data = $.parseJSON(data);
  110. if(data.message.errno == 0) {
  111. util.message('配置成功');
  112. return false;
  113. }
  114. if(data.message.errno < 0) {
  115. util.message(data.message.message);
  116. return false;
  117. }
  118. });
  119. });
  120. </script>
  121. {template 'common/footer'}