indexDown.blade.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. @extends('layouts.admin.app')
  2. @section('crumbs')
  3. <ol class="breadcrumb crumbs">
  4. <li><a href="{{ route('admin.index') }}#">后台导航</a></li>
  5. <li><a href="{{ route('admin.config.index') }}">后台下载配置首页</a></li>
  6. <li class="active">下载配置</li>
  7. </ol>
  8. @endsection
  9. @section('content')
  10. <div id="configs">
  11. <el-form action="{{ route('config.update.down') }}" method="post" id="configs-edit">
  12. <el-row class="form-group">
  13. <el-col :span="3" style="min-height:50px;padding-top:10px;">
  14. 下载链接:
  15. </el-col>
  16. <el-col :span="21" style="min-height:50px;padding-top:10px;">
  17. <a target="_blank" href="{{route('front.m.down')}}">{{route('front.m.down')}}</a>
  18. </el-col>
  19. </el-row>
  20. <ui-file label="Logo" size="2" name="logo" :data="{uploadName:'logo'}" imageurl="{{ $configs->get('logo','') }}" tips=""></ui-file>
  21. <!-- 文件上传 -->
  22. <el-row class="form-group">
  23. <el-col :span="3" style="min-height:50px;padding-top:10px;">
  24. <label style="margin-left:10px;vertical-align: middle;" class="control-label">安卓包</label>
  25. </el-col>
  26. <el-col :span="14" style="min-height:50px;padding-top:10px;">
  27. <el-upload
  28. class="upload-demo"
  29. action="{{ route('admin.file') }}?type=local"
  30. :on-success="handleSuccess"
  31. :headers="headers"
  32. :before-upload="beforeAvatarUpload"
  33. accept=".apk"
  34. name="file"
  35. :file-list="fileList">
  36. <el-button size="small" type="primary">点击上传</el-button>
  37. <div slot="tip" class="el-upload__tip">上传apk文件</div>
  38. </el-upload>
  39. </el-col>
  40. <el-col :span="7" style="min-height:50px;padding-top:10px;">
  41. </el-col>
  42. </el-row>
  43. <input type="hidden" id="android_apk" name="android_apk" value="{{ $configs->get('android_apk','') }}">
  44. <!-- 是否显示 -->
  45. <ui-radio label="ios链接/安装包" :params="params" tips="蓝色标示选中"></ui-radio>
  46. <!-- 文件上传 -->
  47. <el-row class="form-group">
  48. <el-col :span="3" style="min-height:50px;padding-top:10px;">
  49. <label style="margin-left:10px;vertical-align: middle;" class="control-label">IOS包</label>
  50. </el-col>
  51. <el-col :span="14" style="min-height:50px;padding-top:10px;">
  52. <el-upload
  53. class="upload-demo"
  54. action="{{ route('admin.file') }}?type=local"
  55. :on-success="handleSuccessIOS"
  56. :headers="headers"
  57. :before-upload="beforeAvatarUploadIOS"
  58. accept=".ipa"
  59. name="file"
  60. :file-list="fileListIOS">
  61. <el-button size="small" type="primary">点击上传</el-button>
  62. <div slot="tip" class="el-upload__tip">上传ipa文件</div>
  63. </el-upload>
  64. </el-col>
  65. <el-col :span="7" style="min-height:50px;padding-top:10px;">
  66. </el-col>
  67. </el-row>
  68. <input type="hidden" id="ios_apk" name="ios_apk" value="{{ $configs->get('ios_apk','') }}">
  69. <ui-input-text label="IOS下载链接:" name="ios_link" value="{{ $configs->get('ios_link','') }}" placeholder="IOS下载链接" maxlength="255" tips="IOS下载链接"></ui-input-text>
  70. <ui-input-text label="安装视频:" name="ios_a_link" value="{{ $configs->get('ios_a_link','') }}" placeholder="安装视频" maxlength="255" tips="安装视频"></ui-input-text>
  71. {{ csrf_field() }}
  72. <hr>
  73. <ui-submit></ui-submit>
  74. </el-form>
  75. </div>
  76. @endsection
  77. @section('scripts')
  78. <script type="application/javascript">
  79. $(function () {
  80. // 注意:Vue组件一定放在jQuery.validator前面验证
  81. new Vue({
  82. el: '#configs',
  83. data :function () {
  84. return {
  85. fileList: [{
  86. name: "{{ $configs->get('android_apk','') }}",
  87. url: "{{ $configs->get('android_apk','') }}"
  88. }],
  89. fileListIOS: [{
  90. name: "{{ $configs->get('ios_apk','') }}",
  91. url: "{{ $configs->get('ios_apk','') }}"
  92. }],
  93. headers: {
  94. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  95. },
  96. params: {
  97. // 注意:group和attr连个属性都不能省略 就算为空
  98. group: {},
  99. attr: {
  100. name: 'ios_ios_link_radio', // 当前checkbox框的name属性 【必填】
  101. radioCheck:{{ config('admins.ios_ios_link_radio', 0) }}, // 当前选中项 int | string 【必填】
  102. label: 'el-radio-button', // 当前样式 默认 el-radio 样式 【非必填】
  103. radios: [ // 每个checkbox 就是一个json对象 【必填】
  104. {
  105. value:0, // 当前选中时值也就是value属性的值 【必填】
  106. label: 'ios链接', // 当前提示文字 【必填】
  107. disable: false // 是否禁止点击 默认:false 不禁止
  108. },
  109. {
  110. value:1, // 当前选中时值也就是value属性的值 【必填】
  111. label: 'ios安装包', // 当前提示文字 【必填】
  112. disable: false // 是否禁止点击 默认:false 不禁止
  113. }
  114. ]
  115. }
  116. }
  117. };
  118. },
  119. methods: {
  120. handleSuccess(response, file, fileList) {
  121. if( response.code >= 1 ){
  122. // 消息 response.message
  123. this.$message.error(response.message);
  124. }else{
  125. this.fileList = fileList.slice(-1);
  126. $('#android_apk').val(response.url);
  127. // 消息 response.message
  128. this.$message.success("文件上传成功");
  129. }
  130. },
  131. handleSuccessIOS(response, file, fileList) {
  132. if( response.code >= 1 ){
  133. // 消息 response.message
  134. this.$message.error(response.message);
  135. }else{
  136. this.fileListIOS = fileList.slice(-1);
  137. $('#ios_apk').val(response.url);
  138. // 消息 response.message
  139. this.$message.success("文件上传成功");
  140. }
  141. },
  142. beforeAvatarUpload(file) {
  143. const isJPG = file.type === 'application/vnd.android.package-archive';
  144. const isLt2M = file.size / 1024 / 1024 < 200;
  145. if (!isJPG) {
  146. this.$message.error('上传文件支持apk');
  147. }
  148. if (!isLt2M) {
  149. this.$message.error('上传文件最大 200MB!');
  150. }
  151. return isJPG && isLt2M;
  152. },
  153. beforeAvatarUploadIOS(file) {
  154. console.log(file.type);
  155. // const isJPG = file.type === 'application/vnd.android.package-archive';
  156. const isLt2M = file.size / 1024 / 1024 < 200;
  157. // if (!isJPG) {
  158. // this.$message.error('上传文件支持apk');
  159. // }
  160. if (!isLt2M) {
  161. this.$message.error('上传文件最大 200MB!');
  162. return false;
  163. }
  164. return true;
  165. }
  166. }
  167. });
  168. // 编辑保存变量
  169. window.formDatum = $('form').serialize();
  170. });
  171. </script>
  172. @component('layouts.admin.admin_component')@endcomponent
  173. @endsection