mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-03 02:58:42 +00:00
Add #15 流量额度单位 下拉列表
This commit is contained in:
@@ -65,7 +65,8 @@ class ShopController extends Controller
|
||||
}
|
||||
|
||||
try {
|
||||
$data = $request->except('_token', 'logo');
|
||||
$data = $request->except('_token', 'logo', 'traffic', 'traffic_unit');
|
||||
$data['traffic'] = $request->input('traffic') * $request->input('traffic_unit') ?? 1;
|
||||
$data['logo'] = $logo ?? null;
|
||||
$data['is_hot'] = $request->input('is_hot') ? 1 : 0;
|
||||
$data['status'] = $request->input('status') ? 1 : 0;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
* Laravel - A PHP Framework For Web Artisans.
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|
||||
@@ -93,7 +93,12 @@
|
||||
<label class="col-md-2 col-form-label" for="traffic">流量额度</label>
|
||||
<div class="col-md-4 input-group">
|
||||
<input type="number" class="form-control" name="traffic" id="traffic" value="100"/>
|
||||
<span class="input-group-text">MB</span>
|
||||
<select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="form-control" name="traffic_unit" id="traffic_unit">
|
||||
<option value="" selected>MB</option>
|
||||
<option value="1024">GB</option>
|
||||
<option value="1048576">TB</option>
|
||||
<option value="1073741824">PB</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
@@ -204,7 +209,6 @@
|
||||
$('#period').val('{{$goods->period}}');
|
||||
$('#days').val('{{$goods->days}}').attr('disabled', true);
|
||||
@endif
|
||||
$('#traffic').val('{{$goods->traffic}}').attr('disabled', true);
|
||||
$('#invite_num').val('{{$goods->invite_num}}');
|
||||
$('#limit_num').val('{{$goods->limit_num}}');
|
||||
@if ($goods->is_hot)
|
||||
@@ -217,6 +221,22 @@
|
||||
$('#color').asColorPicker('val', '{{$goods->color}}');
|
||||
$('#description').val('{{$goods->description}}');
|
||||
$('#info').val('{!! $goods->info !!}');
|
||||
const trafficUnit = $('#traffic_unit');
|
||||
const traffic = $('#traffic');
|
||||
@if($goods->traffic >= 1073741824)
|
||||
traffic.val('{{$goods->traffic/1073741824}}');
|
||||
trafficUnit.selectpicker('val', '1073741824');
|
||||
@elseif($goods->traffic >= 1048576)
|
||||
traffic.val('{{$goods->traffic/1048576}}');
|
||||
trafficUnit.selectpicker('val', '1048576');
|
||||
@elseif($goods->traffic >= 1024)
|
||||
traffic.val('{{$goods->traffic/1024}}');
|
||||
trafficUnit.selectpicker('val', '1024');
|
||||
@else
|
||||
traffic.val('{{$goods->traffic}}');
|
||||
@endif
|
||||
traffic.attr('disabled', true);
|
||||
trafficUnit.attr('disabled', true).selectpicker('refresh');
|
||||
});
|
||||
@elseif(old('type'))
|
||||
$(document).ready(function() {
|
||||
@@ -232,6 +252,7 @@
|
||||
$('#days').val('{{old('days',0)}}');
|
||||
@endif
|
||||
$('#traffic').val('{{old('traffic')}}');
|
||||
$('#traffic_unit').selectpicker('val', '{{old('traffic_unit')}}');
|
||||
$('#invite_num').val('{{old('invite_num')}}');
|
||||
$('#limit_num').val('{{old('limit_num')}}');
|
||||
@if (old('is_hot'))
|
||||
|
||||
Reference in New Issue
Block a user