提交代码
This commit is contained in:
43
app/Admin/Extensions/WangEditor.php
Normal file
43
app/Admin/Extensions/WangEditor.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Extensions;
|
||||
|
||||
use Encore\Admin\Form\Field;
|
||||
|
||||
class WangEditor extends Field
|
||||
{
|
||||
protected $view = 'admin.wang-editor';
|
||||
|
||||
protected static $css = [
|
||||
'/vendor/wangEditor-3.1.1/release/wangEditor.min.css',
|
||||
];
|
||||
|
||||
protected static $js = [
|
||||
'/vendor/wangEditor-3.1.1/release/wangEditor.min.js',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$_token = csrf_token();
|
||||
$name = $this->formatName($this->column);
|
||||
|
||||
$this->script = <<<EOT
|
||||
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#{$this->id}');
|
||||
editor.customConfig.zIndex = 0
|
||||
editor.customConfig.uploadImgServer = '/admin/uploads/editor'
|
||||
editor.customConfig.uploadImgMaxSize = 2 * 1024 * 1024
|
||||
editor.customConfig.uploadFileName = 'image[]'
|
||||
editor.customConfig.uploadImgParams = {
|
||||
_token: '{$_token}'
|
||||
}
|
||||
editor.customConfig.onchange = function (html) {
|
||||
$('input[name=\'$name\']').val(html);
|
||||
}
|
||||
editor.create()
|
||||
|
||||
EOT;
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
36
app/Admin/Extensions/mobile.php
Normal file
36
app/Admin/Extensions/mobile.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace App\Admin\Extensions;
|
||||
|
||||
/**
|
||||
* 校验手机号
|
||||
*/
|
||||
class mobile
|
||||
{
|
||||
|
||||
public function phoneOperator()
|
||||
{
|
||||
$isPhone = "/^1[3-9]\d{9}$/"; //先判断正确手机号格式
|
||||
|
||||
if (preg_match($isPhone, $phone)) {
|
||||
|
||||
$isChinaMobile = "/^134[0-9]\d{7}$|^1703\d{7}$|^170[5-6]\d{7}$|^(?:13[5-9]|147|148|15[0-27-9]|178|18[2-478]|198)\d{8}$/"; //
|
||||
$isChinaUnion = "/^1704\d{7}$|^170[7-9]\d{7}$|^171[0-9]\d{7}$|^(?:13[0-2]|145|15[56]|166|140|175|176|18[56])\d{8}$/"; //
|
||||
$isChinaTelcom = "/^(?:133|153|169|177|173|174|170|179|18[019]|199)\d{8}$|^170[0-2]\d{7}$/"; //
|
||||
|
||||
if (preg_match($isChinaMobile, $phone)) {
|
||||
return 'mobile'; //中国移动
|
||||
} else if (preg_match($isChinaUnion, $phone)) {
|
||||
return 'unicom'; //中国联通
|
||||
} else if (preg_match($isChinaTelcom, $phone)) {
|
||||
return 'telecom'; //中国电信
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user