index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. @extends('base.base')
  2. @section('base')
  3. <!-- 内容区域 -->
  4. <div class="main-panel">
  5. <div class="content-wrapper">
  6. <div class="page-header">
  7. <h3 class="page-title">
  8. <span class="page-title-icon bg-gradient-primary text-white mr-2">
  9. <i class="mdi mdi-settings"></i>
  10. </span>
  11. {{ __('auto.投放渠道管理') }}
  12. </h3>
  13. <nav aria-label="breadcrumb">
  14. <ol class="breadcrumb">
  15. <li class="breadcrumb-item"><a href="#">{{ __('auto.渠道管理') }}</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ __('auto.投放渠道管理') }}</li>
  17. </ol>
  18. </nav>
  19. </div>
  20. <div class="row">
  21. <div class="col-lg-12 grid-margin stretch-card">
  22. <div class="card">
  23. <div class="card-body">
  24. <h4 class="card-title">{{ __('auto.投放渠道管理') }}</h4>
  25. <form class="well form-inline margin-top-20" method="get" action='/admin/web_channel_config/list'>
  26. <span style="padding-left: 5px">{{ __('auto.渠道号:') }}</span>
  27. <input type="text" name="Channel" value="{{$channel}}" class="form-control">&nbsp;&nbsp;
  28. <span style="padding-left: 5px">{{ __('auto.包名:') }}</span>
  29. <input type="text" name="PackageName" value="{{$packageName}}" class="form-control">&nbsp;&nbsp;
  30. <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
  31. <a href="/admin/web_channel_config/list" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}&{{ __('auto.刷新') }}</a>&nbsp;&nbsp;
  32. </form>
  33. <br>
  34. {{-- <button type="button" class="btn btn-sm btn-gradient-success btn-icon-text" onclick="add()">--}}
  35. {{-- <i class="mdi mdi-plus btn-icon-prepend"></i>--}}
  36. {{-- {{ __('auto.添加配置') }}--}}
  37. {{-- </button>--}}
  38. <button type="button" class="btn btn-sm btn-gradient-primary btn-icon-text" onclick="quickCreateChannel()">
  39. <i class="mdi mdi-plus btn-icon-prepend"></i>
  40. {{ __('auto.快速创建渠道') }}
  41. </button>
  42. <br><br>
  43. <table class="table table-bordered">
  44. <thead>
  45. <tr>
  46. <th>ID</th>
  47. <th>{{ __('auto.渠道号') }}</th>
  48. <th>{{ __('auto.包名') }}</th>
  49. <th>RegionID</th>
  50. <th>{{ __('auto.网站地址') }}</th>
  51. <th>{{ __('auto.备注') }}</th>
  52. <th>StateNo</th>
  53. <th>Platform</th>
  54. <th>PlatformToken</th>
  55. <th>BonusArr</th>
  56. <th>{{ __('auto.操作') }}</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. @foreach($list as $k=>$v)
  61. <tr>
  62. <td>{{$v->ID}}</td>
  63. <td>{{$v->Channel}}</td>
  64. <td>{{$v->PackageName}}</td>
  65. <td>
  66. @php
  67. $regionInfo = $regionMap[$v->RegionID] ?? null;
  68. @endphp
  69. @if($regionInfo && $regionInfo['has_logo'])
  70. <div style="background-color: #000; display: inline-block; padding: 2px; width: 100%; text-align: center;">
  71. @if(!empty($regionInfo['is_svg']))
  72. <object data="{{$regionInfo['logo']}}" type="image/svg+xml" style="max-height: 30px; width: 100%; height: auto; pointer-events: none;" title="{{$v->RegionID}}">
  73. <img src="{{$regionInfo['logo']}}" style="max-height: 30px; width: auto;" alt="Logo" title="{{$v->RegionID}}">
  74. </object>
  75. @else
  76. <img src="{{$regionInfo['logo']}}" style="max-height: 30px; width: auto;" alt="Logo" title="{{$v->RegionID}}">
  77. @endif
  78. </div>
  79. @else
  80. <span style="color: {{$regionInfo['color'] ?? ''}}">{{$v->RegionID}}</span>
  81. @endif
  82. </td>
  83. <td>
  84. @php
  85. $channelUrl = $channelUrls[$v->ID] ?? '';
  86. @endphp
  87. @if($channelUrl)
  88. <a href="javascript:void(0);"
  89. onclick="copyToClipboard('{{$channelUrl}}', this)"
  90. style="color: #007bff; text-decoration: none; cursor: pointer;"
  91. title="{{ __('auto.点击复制') }}">
  92. {{$channelUrl}}
  93. </a>
  94. @else
  95. <span style="color: #999;">-</span>
  96. @endif
  97. </td>
  98. <td contentEditable="true" onblur="remarks(this, {{$v->ID}})" style="cursor: text;">{{$v->Remarks}}</td>
  99. <td>{{$v->StateNo}}</td>
  100. <td>{{$v->PlatformName}} ({{$v->PlatformID}})</td>
  101. <td>
  102. @if(!empty($v->PlatformToken))
  103. <span style="color: #28a745;">{{ __('auto.已配置') }}</span>
  104. @else
  105. <span style="color: #dc3545;">{{ __('auto.未配置') }}</span>
  106. @endif
  107. </td>
  108. <td>{{$v->BonusArr}}</td>
  109. <td>
  110. <button class="btn btn-sm btn-gradient-dark" onclick="edit({{$v->ID}})">
  111. {{ __('auto.修改') }}
  112. </button>
  113. </td>
  114. </tr>
  115. @endforeach
  116. </tbody>
  117. </table>
  118. <div class="box-footer clearfix" id="pages">
  119. {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
  120. {!! $list->appends(['Channel' => $channel, 'PackageName' => $packageName])->links() !!}
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <script>
  129. function add() {
  130. layer.open({
  131. type: 2,
  132. title: '{{ __('auto.添加配置') }}',
  133. shadeClose: true,
  134. shade: 0.8,
  135. area: ['70%', '80%'],
  136. content: '/admin/web_channel_config/add'
  137. });
  138. }
  139. function edit(id) {
  140. layer.open({
  141. type: 2,
  142. title: '{{ __('auto.修改配置') }}',
  143. shadeClose: true,
  144. shade: 0.8,
  145. area: ['70%', '80%'],
  146. content: '/admin/web_channel_config/update/' + id
  147. });
  148. }
  149. function copyToClipboard(text, element) {
  150. // 创建临时文本域
  151. var tempInput = document.createElement('textarea');
  152. tempInput.value = text;
  153. document.body.appendChild(tempInput);
  154. tempInput.select();
  155. try {
  156. // 执行复制
  157. document.execCommand('copy');
  158. // 显示复制成功提示
  159. layer.msg('{{ __('auto.复制成功') }}', {icon: 1, time: 1000});
  160. // 短暂改变链接颜色表示已复制
  161. var originalColor = element.style.color;
  162. element.style.color = '#28a745';
  163. setTimeout(function() {
  164. element.style.color = originalColor;
  165. }, 300);
  166. } catch (err) {
  167. layer.msg('{{ __('auto.复制失败') }}', {icon: 2});
  168. }
  169. // 移除临时文本域
  170. document.body.removeChild(tempInput);
  171. }
  172. // 快速创建渠道
  173. function quickCreateChannel() {
  174. layer.open({
  175. type: 2,
  176. title: '{{ __('auto.快速创建渠道') }}',
  177. shadeClose: true,
  178. shade: 0.8,
  179. area: ['60%', '70%'],
  180. content: '/admin/channel/quick_create_channel',
  181. end: function() {
  182. window.location.reload();
  183. }
  184. });
  185. }
  186. // 修改备注
  187. function remarks(obj, id) {
  188. var remark = $(obj).html();
  189. myRequest("/admin/web_channel_config/remarks/" + id, "post", {remark}, function (res) {
  190. layer.msg(res.msg);
  191. setTimeout(function () {
  192. // window.location.reload();
  193. }, 1500);
  194. });
  195. }
  196. </script>
  197. @endsection