mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-02-01 18:38:14 +00:00
commit
02f582e54e
File diff suppressed because one or more lines are too long
@ -85,28 +85,11 @@ class SystemCleardata extends AuthController
|
||||
SystemCleardata::ClearData('store_service_log',1);
|
||||
return Json::successful('清除数据成功!');
|
||||
}
|
||||
//修改用户默认密码
|
||||
public function userdate(){
|
||||
// SystemCleardata::ClearData('user',1);
|
||||
$headimgurl= WechatUser::Where('uid',1)->value('headimgurl');
|
||||
$data['account']='crmeb';
|
||||
$data['pwd']=md5(123456);
|
||||
$data['avatar']=$headimgurl;
|
||||
$data['add_time']=time();
|
||||
$data['status']=1;
|
||||
$data['level']=0;
|
||||
$data['user_type']="wechat";
|
||||
$data['is_promoter']=1;
|
||||
User::create($data);
|
||||
return Json::successful('清除数据成功!');
|
||||
}
|
||||
|
||||
//清除微信管理数据
|
||||
public function wechatdata(){
|
||||
SystemCleardata::ClearData('wechat_media',1);
|
||||
SystemCleardata::ClearData('wechat_reply',1);
|
||||
SystemCleardata::ClearData('wechat_news_content',1);
|
||||
SystemCleardata::ClearData('wechat_news',1);
|
||||
SystemCleardata::ClearData('wechat_news_category',1);
|
||||
$this->delDirAndFile('./public/uploads/wechat');
|
||||
return Json::successful('清除数据成功!');
|
||||
}
|
||||
@ -117,15 +100,15 @@ class SystemCleardata extends AuthController
|
||||
}
|
||||
//清除微信用户
|
||||
public function wechatuserdata(){
|
||||
$data= WechatUser::get(1)->toArray();
|
||||
SystemCleardata::ClearData('wechat_user',1);
|
||||
unset($data['uid']);
|
||||
WechatUser::set($data);
|
||||
SystemCleardata::ClearData('user',1);
|
||||
return Json::successful('清除数据成功!');
|
||||
}
|
||||
//清除内容分类
|
||||
public function articledata(){
|
||||
SystemCleardata::ClearData('article_category',1);
|
||||
SystemCleardata::ClearData('article',1);
|
||||
SystemCleardata::ClearData('article_content',1);
|
||||
$this->delDirAndFile('./public/uploads/article/');
|
||||
return Json::successful('清除数据成功!');
|
||||
}
|
||||
@ -133,9 +116,9 @@ class SystemCleardata extends AuthController
|
||||
public function ClearData($table_name,$status){
|
||||
$table_name = Config::get('database')['prefix'].$table_name;
|
||||
if($status){
|
||||
db::query('TRUNCATE TABLE '.$table_name);
|
||||
@db::query('TRUNCATE TABLE '.$table_name);
|
||||
}else{
|
||||
db::query('DELETE FROM'.$table_name);
|
||||
@db::query('DELETE FROM'.$table_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -75,13 +75,13 @@ class StoreSeckill extends AuthController
|
||||
public function create()
|
||||
{
|
||||
$f = array();
|
||||
$f[] = Form::input('title','产品标题')->required();
|
||||
$f[] = Form::input('info','秒杀活动简介')->type('textarea')->required();
|
||||
$f[] = Form::input('unit_name','单位')->placeholder('个、位')->required();
|
||||
$f[] = Form::dateTimeRange('section_time','活动时间')->required();
|
||||
$f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')))->icon('image')->required();
|
||||
$f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')))->maxLength(5)->icon('images')->required();
|
||||
$f[] = Form::number('price','秒杀价')->min(0)->col(12)->required();
|
||||
$f[] = Form::input('title','产品标题');
|
||||
$f[] = Form::input('info','秒杀活动简介')->type('textarea');
|
||||
$f[] = Form::input('unit_name','单位')->placeholder('个、位');
|
||||
$f[] = Form::dateTimeRange('section_time','活动时间');
|
||||
$f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')))->icon('image');
|
||||
$f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')))->maxLength(5)->icon('images');
|
||||
$f[] = Form::number('price','秒杀价')->min(0)->col(12);
|
||||
$f[] = Form::number('ot_price','原价')->min(0)->col(12);
|
||||
$f[] = Form::number('cost','成本价')->min(0)->col(12);
|
||||
$f[] = Form::number('stock','库存')->min(0)->precision(0)->col(12);
|
||||
@ -93,7 +93,7 @@ class StoreSeckill extends AuthController
|
||||
$f[] = Form::radio('is_postage','是否包邮',1)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(12);
|
||||
$f[] = Form::radio('is_hot','热门推荐',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
|
||||
$f[] = Form::radio('status','活动状态',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
|
||||
$form = Form::make_post_form('开启秒杀',$f,Url::build('save'));
|
||||
$form = Form::make_post_form('添加用户通知',$f,Url::build('save'));
|
||||
$this->assign(compact('form'));
|
||||
return $this->fetch('public/form-builder');
|
||||
}
|
||||
@ -128,6 +128,7 @@ class StoreSeckill extends AuthController
|
||||
],$request);
|
||||
if(!$data['title']) return Json::fail('请输入产品标题');
|
||||
if(!$data['unit_name']) return Json::fail('请输入产品单位');
|
||||
if(!$data['product_id']) return Json::fail('产品ID不能为空');
|
||||
// var_dump($this->request->post());
|
||||
if(count($data['section_time'])<1) return Json::fail('请选择活动时间');
|
||||
$data['start_time'] = strtotime($data['section_time'][0]);
|
||||
@ -217,6 +218,7 @@ class StoreSeckill extends AuthController
|
||||
$product = StoreSeckillModel::get($id);
|
||||
if(!$product) return Json::fail('数据不存在!');
|
||||
$f = array();
|
||||
$f[] = Form::hidden('product_id',$product->getData('product_id'));
|
||||
$f[] = Form::input('title','产品标题',$product->getData('title'));
|
||||
$f[] = Form::input('info','秒杀活动简介',$product->getData('info'))->type('textarea');
|
||||
$f[] = Form::input('unit_name','单位',$product->getData('unit_name'))->placeholder('个、位');
|
||||
|
||||
@ -26,7 +26,7 @@ class Reply extends AuthController
|
||||
$replay = WechatReply::getDataByKey(input('key'));
|
||||
$this->assign('replay_arr',json_encode($replay));
|
||||
$this->assign('key',input('key'));
|
||||
$this->assign('title',input('title'));
|
||||
$this->assign('title',urldecode(input('title')));
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
@ -10,11 +10,15 @@ namespace app\admin\model\order;
|
||||
|
||||
use app\admin\model\wechat\WechatUser;
|
||||
use app\admin\model\ump\StorePink;
|
||||
use app\admin\model\order\StoreOrderCartInfo;
|
||||
use app\admin\model\store\StoreProduct;
|
||||
use app\admin\model\routine\RoutineFormId;
|
||||
use app\admin\model\routine\RoutineTemplate;
|
||||
use service\PHPExcelService;
|
||||
use traits\ModelTrait;
|
||||
use basic\ModelBasic;
|
||||
use service\WechatTemplateService;
|
||||
use service\RoutineTemplateService;
|
||||
use think\Url;
|
||||
use think\Db;
|
||||
/**
|
||||
@ -47,7 +51,12 @@ class StoreOrder extends ModelBasic
|
||||
}else{
|
||||
$model = $model->order('a.id desc');
|
||||
}
|
||||
$data=($data=$model->page((int)$where['page'],(int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
|
||||
if(isset($where['excel']) && $where['excel']==1){
|
||||
$data=($data=$model->select()) && count($data) ? $data->toArray() : [];
|
||||
}else{
|
||||
$data=($data=$model->page((int)$where['page'],(int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
|
||||
}
|
||||
// $data=($data=$model->page((int)$where['page'],(int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
|
||||
foreach ($data as &$item){
|
||||
$_info = Db::name('store_order_cart_info')->where('oid',$item['id'])->field('cart_info')->select();
|
||||
foreach ($_info as $k=>$v){
|
||||
@ -460,6 +469,7 @@ HTML;
|
||||
* @return array
|
||||
*/
|
||||
public static function getOrderPrice($where){
|
||||
$where['is_del'] = 0;//删除订单不统计
|
||||
$model = new self;
|
||||
$price = array();
|
||||
$price['pay_price'] = 0;//支付金额
|
||||
@ -473,7 +483,7 @@ HTML;
|
||||
$price['deduction_price'] = 0;//抵扣金额
|
||||
$price['total_num'] = 0; //商品总数
|
||||
$model = self::getOrderWhere($where,$model);
|
||||
$list = $model->select()->toArray();
|
||||
$list = $model->where('is_del',0)->select()->toArray();
|
||||
foreach ($list as $v){
|
||||
$price['total_num'] = bcadd($price['total_num'],$v['total_num'],0);
|
||||
$price['pay_price'] = bcadd($price['pay_price'],$v['pay_price'],2);
|
||||
@ -871,30 +881,84 @@ HTML;
|
||||
]
|
||||
];
|
||||
}
|
||||
/*
|
||||
* 退款列表
|
||||
* $where array
|
||||
* return array
|
||||
|
||||
/**微信 订单发货
|
||||
* @param $oid
|
||||
* @param array $postageData
|
||||
*/
|
||||
// public static function getRefundList($where){
|
||||
// $refundlist=self::setEchatWhere($where)->field([
|
||||
// 'order_id','total_price','coupon_price','deduction_price',
|
||||
// 'use_integral','FROM_UNIXTIME(add_time,"%Y-%m-%d") as add_time','FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time','combination_id',
|
||||
// 'seckill_id','bargain_id','cost','status','cart_id','pay_price','refund_status'
|
||||
// ])->page((int)$where['page'],(int)$where['limit'])->select();
|
||||
// count($refundlist) && $refundlist=$refundlist->toArray();
|
||||
// foreach($refundlist as &$item){
|
||||
// $item['product']=StoreProduct::where('id','in',function ($quers) use($item){
|
||||
// $quers->name('store_cart')->where('id','in',json_decode($item['cart_id'],true))->field('product_id');
|
||||
// })->field(['store_name','cost','price','image'])->select()->toArray();
|
||||
// if($item['refund_status']==1) {
|
||||
// $item['_refund'] = '申请退款中';
|
||||
// }elseif ($item['refund_status']==2){
|
||||
// $item['_refund'] = '退款成功';
|
||||
// }
|
||||
// }
|
||||
// return $refundlist;
|
||||
// }
|
||||
public static function orderPostageAfter($oid,$postageData = [])
|
||||
{
|
||||
$order = self::where('id',$oid)->find();
|
||||
$openid = WechatUser::uidToOpenid($order['uid']);
|
||||
$url = Url::build('wap/My/order',['uni'=>$order['order_id']],true,true);
|
||||
$group = [
|
||||
'first'=>'亲,您的订单已发货,请注意查收',
|
||||
'remark'=>'点击查看订单详情'
|
||||
];
|
||||
if($postageData['delivery_type'] == 'send'){//送货
|
||||
$goodsName = StoreOrderCartInfo::getProductNameList($order['id']);
|
||||
$group = array_merge($group,[
|
||||
'keyword1'=>$goodsName,
|
||||
'keyword2'=>$order['pay_type'] == 'offline' ? '线下支付' : date('Y/m/d H:i',$order['pay_time']),
|
||||
'keyword3'=>$order['user_address'],
|
||||
'keyword4'=>$postageData['delivery_name'],
|
||||
'keyword5'=>$postageData['delivery_id']
|
||||
]);
|
||||
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_DELIVER_SUCCESS,$group,$url);
|
||||
|
||||
}else if($postageData['delivery_type'] == 'express'){//发货
|
||||
$group = array_merge($group,[
|
||||
'keyword1'=>$order['order_id'],
|
||||
'keyword2'=>$postageData['delivery_name'],
|
||||
'keyword3'=>$postageData['delivery_id']
|
||||
]);
|
||||
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_POSTAGE_SUCCESS,$group,$url);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 小程序 订单发货提醒
|
||||
* @param int $oid
|
||||
* @param array $postageData
|
||||
* @return bool
|
||||
*/
|
||||
public static function sendOrderGoods($oid = 0,$postageData=array()){
|
||||
if(!$oid || !$postageData) return true;
|
||||
$order = self::where('id',$oid)->find();
|
||||
$routine_openid = WechatUser::uidToRoutineOpenid($order['uid']);
|
||||
if(!$routine_openid) return true;
|
||||
if($postageData['delivery_type'] == 'send'){//送货
|
||||
$data['keyword1']['value'] = $order['order_id'];
|
||||
$data['keyword2']['value'] = $order['delivery_name'];
|
||||
$data['keyword3']['value'] = $order['delivery_id'];
|
||||
$data['keyword4']['value'] = date('Y-m-d H:i:s',time());
|
||||
$data['keyword5']['value'] = '您的商品已经发货请注意查收';
|
||||
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||
if($formId){
|
||||
RoutineFormId::delFormIdOne($formId);
|
||||
RoutineTemplateService::sendTemplate($routine_openid,
|
||||
RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_DELIVER_SUCCESS),
|
||||
'',
|
||||
$data,
|
||||
$formId);
|
||||
}
|
||||
}else if($postageData['delivery_type'] == 'express'){//发货
|
||||
$data['keyword1']['value'] = $order['order_id'];
|
||||
$data['keyword2']['value'] = $order['delivery_name'];
|
||||
$data['keyword3']['value'] = $order['delivery_id'];
|
||||
$data['keyword4']['value'] = date('Y-m-d H:i:s',time());
|
||||
$data['keyword5']['value'] = '您的商品已经发货请注意查收';
|
||||
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||
if($formId){
|
||||
RoutineFormId::delFormIdOne($formId);
|
||||
RoutineTemplateService::sendTemplate($routine_openid,
|
||||
RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_POSTAGE_SUCCESS),
|
||||
'',
|
||||
$data,
|
||||
$formId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单总数
|
||||
|
||||
33
application/admin/model/order/StoreOrderCartInfo.php
Normal file
33
application/admin/model/order/StoreOrderCartInfo.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author: xaboy<365615158@qq.com>
|
||||
* @day: 2017/12/26
|
||||
*/
|
||||
|
||||
namespace app\admin\model\order;
|
||||
|
||||
|
||||
use basic\ModelBasic;
|
||||
use traits\ModelTrait;
|
||||
|
||||
class StoreOrderCartInfo extends ModelBasic
|
||||
{
|
||||
use ModelTrait;
|
||||
|
||||
/** 获取订单产品列表
|
||||
* @param $oid
|
||||
* @return array
|
||||
*/
|
||||
public static function getProductNameList($oid)
|
||||
{
|
||||
$cartInfo = self::where('oid',$oid)->select();
|
||||
$goodsName = [];
|
||||
foreach ($cartInfo as $cart){
|
||||
$suk = isset($cart['cart_info']['productInfo']['attrInfo']) ? '('.$cart['cart_info']['productInfo']['attrInfo']['suk'].')' : '';
|
||||
$goodsName[] = $cart['cart_info']['productInfo']['store_name'].$suk;
|
||||
}
|
||||
return $goodsName;
|
||||
}
|
||||
|
||||
}
|
||||
43
application/admin/model/routine/RoutineFormId.php
Normal file
43
application/admin/model/routine/RoutineFormId.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace app\admin\model\routine;
|
||||
|
||||
use basic\ModelBasic;
|
||||
use traits\ModelTrait;
|
||||
|
||||
/**
|
||||
* 表单ID表
|
||||
* Class RoutineFormId
|
||||
* @package app\routine\model\routine
|
||||
*/
|
||||
class RoutineFormId extends ModelBasic {
|
||||
|
||||
use ModelTrait;
|
||||
|
||||
/**
|
||||
* 删除已失效的formID
|
||||
* @return int
|
||||
*/
|
||||
public static function delStatusInvalid(){
|
||||
return self::where('status',2)->where('stop_time','LT',time())->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个可以使用的formId
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public static function getFormIdOne($uid = 0){
|
||||
$formId = self::where('status',1)->where('stop_time','GT',time())->where('uid',$uid)->order('id asc')->find();
|
||||
if($formId) return $formId['form_id'];
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一个FormID为已使用
|
||||
* @param string $formId
|
||||
* @return $this|bool
|
||||
*/
|
||||
public static function delFormIdOne($formId = ''){
|
||||
if($formId == '') return true;
|
||||
return self::where('form_id',$formId)->update(['status'=>2]);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
51
application/admin/model/user/UserAddress.php
Normal file
51
application/admin/model/user/UserAddress.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author: xaboy<365615158@qq.com>
|
||||
* @day: 2017/12/25
|
||||
*/
|
||||
|
||||
namespace app\admin\model\user;
|
||||
|
||||
|
||||
use basic\ModelBasic;
|
||||
use traits\ModelTrait;
|
||||
|
||||
class UserAddress extends ModelBasic
|
||||
{
|
||||
use ModelTrait;
|
||||
|
||||
protected $insert = ['add_time'];
|
||||
|
||||
protected function setAddTimeAttr()
|
||||
{
|
||||
return time();
|
||||
}
|
||||
|
||||
public static function setDefaultAddress($id,$uid)
|
||||
{
|
||||
self::beginTrans();
|
||||
$res1 = self::where('uid',$uid)->update(['is_default'=>0]);
|
||||
$res2 = self::where('id',$id)->where('uid',$uid)->update(['is_default'=>1]);
|
||||
$res =$res1 !== false && $res2 !== false;
|
||||
self::checkTrans($res);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function userValidAddressWhere($model=null,$prefix = '')
|
||||
{
|
||||
if($prefix) $prefix .='.';
|
||||
$model = self::getSelfModel($model);
|
||||
return $model->where("{$prefix}is_del",0);
|
||||
}
|
||||
|
||||
public static function getUserValidAddressList($uid,$field = '*')
|
||||
{
|
||||
return self::userValidAddressWhere()->where('uid',$uid)->order('add_time DESC')->field($field)->select()->toArray()?:[];
|
||||
}
|
||||
|
||||
public static function getUserDefaultAddress($uid,$field = '*')
|
||||
{
|
||||
return self::userValidAddressWhere()->where('uid',$uid)->where('is_default',1)->field($field)->find();
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,7 @@ use service\SystemConfigService;
|
||||
protected $insert = ['add_time'];
|
||||
|
||||
/**
|
||||
* 用uid获得openid
|
||||
* 用uid获得 微信openid
|
||||
* @param $uid
|
||||
* @return mixed
|
||||
*/
|
||||
@ -47,6 +47,21 @@ use service\SystemConfigService;
|
||||
Cache::set($cacheName,$openid,0);
|
||||
return $openid;
|
||||
}
|
||||
/**
|
||||
* 用uid获得 小程序 openid
|
||||
* @param $uid
|
||||
* @return mixed
|
||||
*/
|
||||
public static function uidToRoutineOpenid($uid,$update = false)
|
||||
{
|
||||
$cacheName = 'routine_openid'.$uid;
|
||||
$openid = Cache::get($cacheName);
|
||||
if($openid && !$update) return $openid;
|
||||
$openid = self::where('uid',$uid)->value('routine_openid');
|
||||
if(!$openid) exception('对应的routine_openid不存在!');
|
||||
Cache::set($cacheName,$openid,0);
|
||||
return $openid;
|
||||
}
|
||||
|
||||
public static function setAddTimeAttr($value)
|
||||
{
|
||||
@ -145,7 +160,7 @@ use service\SystemConfigService;
|
||||
* @return array
|
||||
*/
|
||||
public static function agentSystemPage($where = array(),$isall=false){
|
||||
self::setWechatUserOrder();//设置 一级推荐人 二级推荐人 一级推荐人订单 二级推荐人订单 佣金
|
||||
// self::setWechatUserOrder();//设置 一级推荐人 二级推荐人 一级推荐人订单 二级推荐人订单 佣金
|
||||
$model = new self;
|
||||
if($isall==false) {
|
||||
$status = (int)SystemConfigService::get('store_brokerage_statu');
|
||||
@ -200,7 +215,7 @@ use service\SystemConfigService;
|
||||
->ExcelSave();
|
||||
}
|
||||
return self::page($model,function ($item){
|
||||
$item['qr_code'] = QrcodeService::getForeverQrcode('spread',$item['uid'])?:'';
|
||||
$item['qr_code'] = QrcodeService::getForeverQrcode('spread',$item['uid']);
|
||||
$item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid']);//累计提现
|
||||
$item['extract_count_num'] = UserExtract::getUserCountNum($item['uid']);//提现次数
|
||||
},$where);
|
||||
|
||||
@ -486,6 +486,7 @@
|
||||
});
|
||||
},
|
||||
search:function () {
|
||||
this.where.excel=0;
|
||||
this.getBadge();
|
||||
layList.reload(this.where);
|
||||
},
|
||||
|
||||
@ -3,7 +3,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?=$form->getTitle()?></title>
|
||||
<?=implode("\r\n",$form->getScript())?>
|
||||
<script src="https://cdn.bootcss.com/vue/2.5.13/vue.min.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/iview@2.14.3/dist/styles/iview.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/iview@2.14.3/dist/iview.min.js"></script>
|
||||
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/form-create/district/province_city.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/form-create@1.5.1/dist/form-create.min.js"></script>
|
||||
<style>
|
||||
/*弹框样式修改*/
|
||||
.ivu-modal-body{padding: 5;}
|
||||
@ -23,9 +28,86 @@
|
||||
//提交成功后按钮恢复
|
||||
$r.btn.finish();
|
||||
};
|
||||
(function () {
|
||||
var create = <?=$form->formScript()?>
|
||||
create();
|
||||
|
||||
(function () {
|
||||
var create = (function () {
|
||||
var getRule = function () {
|
||||
var rule = <?=json_encode($form->getRules())?>;
|
||||
rule.forEach(function (c) {
|
||||
if ((c.type == 'cascader' || c.type == 'tree') && Object.prototype.toString.call(c.props.data) == '[object String]') {
|
||||
if (c.props.data.indexOf('js.') === 0) {
|
||||
c.props.data = window[c.props.data.replace('js.', '')];
|
||||
}
|
||||
}
|
||||
});
|
||||
return rule;
|
||||
}, vm = new Vue,name = 'formBuilderExec<?= !$form->getId() ? '' : '_'.$form->getId() ?>';
|
||||
var _b = false;
|
||||
window[name] = function create(el, callback) {
|
||||
if(_b) return ;
|
||||
_b = true;
|
||||
if (!el) el = document.body;
|
||||
var $f = formCreate.create(getRule(), {
|
||||
el: el,
|
||||
form:<?=json_encode($form->getConfig('form'))?>,
|
||||
row:<?=json_encode($form->getConfig('row'))?>,
|
||||
submitBtn:<?=$form->isSubmitBtn() ? '{}' : 'false'?>,
|
||||
resetBtn:<?=$form->isResetBtn() ? 'true' : '{}'?>,
|
||||
iframeHelper:true,
|
||||
upload: {
|
||||
onExceededSize: function (file) {
|
||||
vm.$Message.error(file.name + '超出指定大小限制');
|
||||
},
|
||||
onFormatError: function () {
|
||||
vm.$Message.error(file.name + '格式验证失败');
|
||||
},
|
||||
onError: function (error) {
|
||||
vm.$Message.error(file.name + '上传失败,(' + error + ')');
|
||||
},
|
||||
onSuccess: function (res) {
|
||||
if (res.code == 200) {
|
||||
return res.data.filePath;
|
||||
} else {
|
||||
vm.$Message.error(res.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
//表单提交事件
|
||||
onSubmit: function (formData) {
|
||||
$f.submitStatus({loading: true});
|
||||
$.ajax({
|
||||
url: '<?=$form->getAction()?>',
|
||||
type: '<?=$form->getMethod()?>',
|
||||
dataType: 'json',
|
||||
data: formData,
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
vm.$Message.success(res.msg);
|
||||
$f.submitStatus({loading: false});
|
||||
formCreate.formSuccess && formCreate.formSuccess(res, $f, formData);
|
||||
callback && callback(0, res, $f, formData);
|
||||
//TODO 表单提交成功!
|
||||
} else {
|
||||
vm.$Message.error(res.msg || '表单提交失败');
|
||||
$f.btn.finish();
|
||||
callback && callback(1, res, $f, formData);
|
||||
//TODO 表单提交失败
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
vm.$Message.error('表单提交失败');
|
||||
$f.btn.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return $f;
|
||||
};
|
||||
return window[name];
|
||||
}());
|
||||
|
||||
window.$f = create();
|
||||
// create();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<button type="button" class="btn btn-w-m btn-danger btn-primary cleardata" data-url="{:Url('system.SystemCleardata/wechatuserdata')}">清除微信用户</button><br>
|
||||
<button type="button" class="btn btn-w-m btn-danger btn-primary cleardata" data-url="{:Url('system.SystemCleardata/articledata')}">清除内容分类</button><br>
|
||||
<button type="button" class="btn btn-w-m btn-danger btn-primary cleardata" data-url="{:Url('system.SystemCleardata/uploaddata')}">清除所有附件</button><br>
|
||||
<button type="button" class="btn btn-w-m btn-danger btn-primary creatuser" data-url="{:Url('system.SystemCleardata/userdate')}">创建前台用户用户名:crmeb 密码:123456</button>
|
||||
<!--<button type="button" class="btn btn-w-m btn-danger btn-primary creatuser" data-url="{:Url('system.SystemCleardata/userdate')}">创建前台用户用户名:crmeb 密码:123456</button>-->
|
||||
</div>
|
||||
<script>
|
||||
$('.cleardata').on('click',function(){
|
||||
|
||||
@ -1 +1 @@
|
||||
<?php
namespace app\routine\model\article;
use think\Db;
use traits\ModelTrait;
use basic\ModelBasic;
/**
* Class Article
* @package app\routine\model\article
*/
class Article extends ModelBasic {
use ModelTrait;
/**
* 获取一条新闻
* @param int $id
* @return array|false|\PDOStatement|string|\think\Model
*/
public static function getArticleOne($id = 0){
if(!$id) return [];
$list = self::where('status',1)->where('hide',0)->where('id',$id)->order('id desc')->find();
if($list){
$list = $list->toArray();
$list["content"] = Db::name('articleContent')->where('nid',$id)->value('content');
return $list;
}
else return [];
}
/**
* 获取某个分类底下的文章
* @param $cid
* @param $first
* @param $limit
* @param string $field
* @return mixed
*/
public static function cidByArticleList($cid, $first, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url')
{
$model = new self();
if ($cid) $model->where("CONCAT(',',cid,',') LIKE '%,$cid,%'", 'exp');
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->order('sort DESC,add_time DESC');
if($limit) $model = $model->limit($first, $limit);
return $model->select();
}
/**
* 获取热门文章
* @param string $field
* @return mixed
*/
public static function getArticleListHot($field = 'id,title,image_input,visit,add_time,synopsis,url'){
$model = new self();
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->where('is_hot', 1);
$model = $model->order('sort DESC,add_time DESC');
return $model->select();
}
/**
* 获取轮播文章
* @param string $field
* @return mixed
*/
public static function getArticleListBanner($field = 'id,title,image_input,visit,add_time,synopsis,url'){
$model = new self();
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->where('is_banner', 1);
$model = $model->order('sort DESC,add_time DESC');
return $model->select();
}
}
|
||||
<?php
namespace app\routine\model\article;
use think\Db;
use traits\ModelTrait;
use basic\ModelBasic;
/**
* Class Article
* @package app\routine\model\article
*/
class Article extends ModelBasic {
use ModelTrait;
/**
* 获取一条新闻
* @param int $id
* @return array|false|\PDOStatement|string|\think\Model
*/
public static function getArticleOne($id = 0){
if(!$id) return [];
$list = self::where('status',1)->where('hide',0)->where('id',$id)->order('id desc')->find();
if($list){
$list = $list->toArray();
$list["content"] = Db::name('articleContent')->where('nid',$id)->value('content');
return $list;
}
else return [];
}
/**
* 获取某个分类底下的文章
* @param $cid
* @param $first
* @param $limit
* @param string $field
* @return mixed
*/
public static function cidByArticleList($cid, $first, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url')
{
$model = new self();
if ($cid) $model->where("CONCAT(',',cid,',')" ,'LIKE'," '%,$cid,%'");
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->order('sort DESC,add_time DESC');
if($limit) $model = $model->limit($first, $limit);
return $model->select();
}
/**
* 获取热门文章
* @param string $field
* @return mixed
*/
public static function getArticleListHot($field = 'id,title,image_input,visit,add_time,synopsis,url'){
$model = new self();
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->where('is_hot', 1);
$model = $model->order('sort DESC,add_time DESC');
return $model->select();
}
/**
* 获取轮播文章
* @param string $field
* @return mixed
*/
public static function getArticleListBanner($field = 'id,title,image_input,visit,add_time,synopsis,url'){
$model = new self();
$model = $model->field($field);
$model = $model->where('status', 1);
$model = $model->where('hide', 0);
$model = $model->where('is_banner', 1);
$model = $model->order('sort DESC,add_time DESC');
return $model->select();
}
}
|
||||
@ -86,38 +86,5 @@ class RoutineTemplate{
|
||||
RoutineFormId::delFormIdOne($formId);
|
||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_PAY_SUCCESS),'',$data,$formId);
|
||||
}
|
||||
/**
|
||||
* 订单发货提醒
|
||||
* @param int $oid
|
||||
* @param array $postageData
|
||||
* @return bool
|
||||
*/
|
||||
public static function sendOrderGoods($oid = 0,$postageData=array()){
|
||||
if(!$oid || !$postageData) return true;
|
||||
$order = StoreOrder::where('id',$oid)->find();
|
||||
if(!RoutineUser::isRoutineUser($order['uid'])) return true;
|
||||
if($postageData['delivery_type'] == 'send'){//送货
|
||||
$data['keyword1']['value'] = $order['order_id'];
|
||||
$data['keyword2']['value'] = $order['delivery_name'];
|
||||
$data['keyword3']['value'] = $order['delivery_id'];
|
||||
$data['keyword4']['value'] = date('Y-m-d H:i:s',time());
|
||||
$data['keyword5']['value'] = '您的商品已经发货请注意查收';
|
||||
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||
if($formId){
|
||||
RoutineFormId::delFormIdOne($formId);
|
||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_DELIVER_SUCCESS),'',$data,$formId);
|
||||
}
|
||||
}else if($postageData['delivery_type'] == 'express'){//发货
|
||||
$data['keyword1']['value'] = $order['order_id'];
|
||||
$data['keyword2']['value'] = $order['delivery_name'];
|
||||
$data['keyword3']['value'] = $order['delivery_id'];
|
||||
$data['keyword4']['value'] = date('Y-m-d H:i:s',time());
|
||||
$data['keyword5']['value'] = '您的商品已经发货请注意查收';
|
||||
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||
if($formId){
|
||||
RoutineFormId::delFormIdOne($formId);
|
||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_POSTAGE_SUCCESS),'',$data,$formId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -66,7 +66,6 @@ class StoreProductReply extends ModelBasic
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
public static function tidyProductReply($res)
|
||||
{
|
||||
$res['cart_info'] = json_decode($res['cart_info'],true)?:[];
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
version=CRMEB-DTKY v2.5.3
|
||||
version=CRMEB-DTKY v2.5.33
|
||||
version_code=129
|
||||
@ -21,7 +21,7 @@ class ArticleCategory extends ModelBasic
|
||||
public static function cidByArticleList($cid, $first, $limit, $field = '*')
|
||||
{
|
||||
$model = Db::name('article');
|
||||
if ($cid) $model->where("CONCAT(',',cid,',') LIKE '%,$cid,%'", 'exp');
|
||||
if ($cid) $model->where("CONCAT(',',cid,',')", 'LIKE', "'%,$cid,%'");
|
||||
return $model->field($field)->where('status', 1)->where('hide', 0)->order('sort DESC,add_time DESC')->limit($first, $limit)->select();
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@
|
||||
<div class="price">¥{$storeInfo.price|floatval}</div>
|
||||
<div class="oldprice">原价:¥{$storeInfo.ot_price|floatval}</div>
|
||||
<div class="info-amount flex"><span class="current">商品编号:{$storeInfo.id}</span> <span class="">库存:{$storeInfo.stock}{$storeInfo.unit_name}</span>
|
||||
<span class="fr">销量:{$storeInfo.ficti}{$storeInfo.unit_name}</span></div>
|
||||
<span class="fr">销量:{$storeInfo.ficti+$storeInfo.sales}{$storeInfo.unit_name}</span></div>
|
||||
{gt name="storeInfo['give_integral']" value="0"}
|
||||
<div class="integral">积分:{$storeInfo.give_integral|floatval} <span>赠送</span></div>
|
||||
{/gt}
|
||||
@ -115,6 +115,8 @@
|
||||
this.cardShow = true;
|
||||
}, goCart: function (values, cartNum) {
|
||||
var checkedAttr = this.productValue[values.sort().join(',')], that = this;
|
||||
// console.log(values);
|
||||
// console.log(checkedAttr);
|
||||
storeApi.setCart({
|
||||
cartNum: cartNum,
|
||||
uniqueId: checkedAttr === undefined ? 0 : checkedAttr.unique,
|
||||
@ -135,7 +137,11 @@
|
||||
});
|
||||
this.cardClose();
|
||||
}, changeAttr: function (values) {
|
||||
console.log(values);
|
||||
//console.log(values.sort());
|
||||
//console.log(values.sort().join(','));
|
||||
var checkedAttr = this.productValue[values.sort().join(',')];
|
||||
//console.log(values);console.log(checkedAttr);
|
||||
if (!checkedAttr) {
|
||||
this.setProductCardInfo({stock: 0});
|
||||
} else {
|
||||
@ -225,7 +231,7 @@
|
||||
desc: $product.store_info || $product.store_name,
|
||||
// imgUrl: location.origin + $product.image,
|
||||
imgUrl: $product.image,
|
||||
link: $urlShare || "{:url('store/detail',array('id'=>$store['id'],'spuid'=>$userInfo['uid']))}"
|
||||
link: $urlShare || "{:url('store/detail',array('id'=>$storeInfo['id'],'spuid'=>$userInfo['uid']))}"
|
||||
});
|
||||
});
|
||||
this.$nextTick(function () {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="img"><img :src="item.image" /></div>
|
||||
<div class="info-txt">
|
||||
<p class="name" v-text="item.store_name"></p>
|
||||
<span class="count">已售{{item.ficti}}</span>
|
||||
<span class="count">已售{{item.ficti+item.sales}}</span>
|
||||
<p class="price">¥{{item.price}}</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
26
composer.lock
generated
26
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3dd0118e5d08ef728cb0c2f4f7de15a5",
|
||||
"content-hash": "ae2e50326d8e83fd299c3350bb0f87d1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
@ -1078,16 +1078,16 @@
|
||||
},
|
||||
{
|
||||
"name": "tp5er/tp5-databackup",
|
||||
"version": "dev-master",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tp5er/tp5-databackup.git",
|
||||
"reference": "101477abe810fb91bad5c1304a93c5f461db6dc8"
|
||||
"reference": "10abd4383cf78844e1c22584fd823ef1d18e75dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tp5er/tp5-databackup/zipball/101477abe810fb91bad5c1304a93c5f461db6dc8",
|
||||
"reference": "101477abe810fb91bad5c1304a93c5f461db6dc8",
|
||||
"url": "https://api.github.com/repos/tp5er/tp5-databackup/zipball/10abd4383cf78844e1c22584fd823ef1d18e75dc",
|
||||
"reference": "10abd4383cf78844e1c22584fd823ef1d18e75dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1110,20 +1110,20 @@
|
||||
}
|
||||
],
|
||||
"description": "Implement the database backup restore",
|
||||
"time": "2018-04-07T11:20:53+00:00"
|
||||
"time": "2017-12-29T05:36:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "xaboy/form-builder",
|
||||
"version": "1.2.5",
|
||||
"version": "1.2.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xaboy/form-builder.git",
|
||||
"reference": "73cb5be3d9f57680f64d01ab424c4ac5c462f1b8"
|
||||
"reference": "43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/xaboy/form-builder/zipball/73cb5be3d9f57680f64d01ab424c4ac5c462f1b8",
|
||||
"reference": "73cb5be3d9f57680f64d01ab424c4ac5c462f1b8",
|
||||
"url": "https://api.github.com/repos/xaboy/form-builder/zipball/43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf",
|
||||
"reference": "43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1148,15 +1148,13 @@
|
||||
],
|
||||
"description": "PHP表单生成器,快速生成现代化的form表单。包含复选框、单选框、输入框、下拉选择框等元素以及,省市区三级联动,时间选择,日期选择,颜色选择,文件/图片上传等功能。",
|
||||
"homepage": "https://github.com/xaboy/form-builder",
|
||||
"time": "2018-11-13T12:44:31+00:00"
|
||||
"time": "2018-12-12T12:20:38+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"tp5er/tp5-databackup": 20
|
||||
},
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@ -9,6 +9,7 @@ namespace behavior\routine;
|
||||
|
||||
|
||||
use app\routine\model\store\StoreOrder;
|
||||
use app\routine\model\routine\RoutineTemplate;
|
||||
use app\routine\model\user\User;
|
||||
use app\routine\model\user\WechatUser;
|
||||
use app\routine\model\user\UserAddress;
|
||||
@ -48,9 +49,9 @@ class StoreProductBehavior
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($data,$oid);
|
||||
}
|
||||
// public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||
// StoreOrder::orderPostageAfter($data,$oid);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改发货状态 为发货
|
||||
@ -59,9 +60,10 @@ class StoreProductBehavior
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($data,$oid);
|
||||
}
|
||||
// public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||
// StoreOrder::orderPostageAfter($data,$oid);
|
||||
// RoutineTemplate::sendOrderGoods($oid,$data);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改状态 为已收货
|
||||
|
||||
145
extend/behavior/system/OrderBehavior.php
Normal file
145
extend/behavior/system/OrderBehavior.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author: xaboy<365615158@qq.com>
|
||||
* @day: 2017/12/18
|
||||
*/
|
||||
|
||||
namespace behavior\system;
|
||||
|
||||
|
||||
|
||||
use app\admin\model\user\User;
|
||||
use app\admin\model\user\UserAddress;
|
||||
use app\admin\model\user\UserBill;
|
||||
use app\admin\model\wechat\WechatUser;
|
||||
use basic\ModelBasic;
|
||||
use app\admin\model\order\StoreOrder;
|
||||
use service\SystemConfigService;
|
||||
use service\WechatTemplateService;
|
||||
|
||||
class OrderBehavior
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改发货状态 为送货
|
||||
* @param $data
|
||||
* $data array 送货方式 送货人姓名 送货人电话
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($oid,$data);
|
||||
StoreOrder::sendOrderGoods($oid,$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货状态 为发货
|
||||
* @param $data
|
||||
* $data array 发货方式 送货人姓名 送货人电话
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($oid,$data);
|
||||
StoreOrder::sendOrderGoods($oid,$data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改状态为 已退款
|
||||
* @param $data
|
||||
* $data array type 1 直接退款 2 退款后返回原状态 refund_price 退款金额
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderRefundYAfter($data,$oid){
|
||||
StoreOrder::refundTemplate($data,$oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态为 不退款
|
||||
* @param $data
|
||||
* $data string 退款原因
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderRefundNAfter($data,$oid){
|
||||
|
||||
}
|
||||
/**
|
||||
* 线下付款
|
||||
* @param $id
|
||||
* $id 订单id
|
||||
*/
|
||||
public static function storeProductOrderOffline($id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单状态
|
||||
* @param $data
|
||||
* data total_price 商品总价 pay_price 实际支付
|
||||
* @param $oid
|
||||
* oid 订单id
|
||||
*/
|
||||
public static function storeProductOrderEditAfter($data,$oid){
|
||||
|
||||
}
|
||||
/**
|
||||
* 修改送货信息
|
||||
* @param $data
|
||||
* $data array 送货人姓名/快递公司 送货人电话/快递单号
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDistributionAfter($data,$oid){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户申请退款
|
||||
* @param $oid
|
||||
* @param $uid
|
||||
*/
|
||||
public static function storeProductOrderApplyRefundAfter($oid, $uid)
|
||||
{
|
||||
$order = StoreOrder::where('id',$oid)->find();
|
||||
WechatTemplateService::sendAdminNoticeTemplate([
|
||||
'first'=>"亲,您有一个订单申请退款 \n订单号:{$order['order_id']}",
|
||||
'keyword1'=>'申请退款',
|
||||
'keyword2'=>'待处理',
|
||||
'keyword3'=>date('Y/m/d H:i',time()),
|
||||
'remark'=>'请及时处理'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 评价产品
|
||||
* @param $replyInfo
|
||||
* @param $cartInfo
|
||||
*/
|
||||
public static function storeProductOrderReply($replyInfo, $cartInfo)
|
||||
{
|
||||
//StoreOrder::checkOrderOver($cartInfo['oid']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退积分
|
||||
* @param $product
|
||||
* $product 商品信息
|
||||
* @param $back_integral
|
||||
* $back_integral 退多少积分
|
||||
*/
|
||||
public static function storeOrderIntegralBack($product,$back_integral){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -59,9 +59,9 @@ class StoreProductBehavior
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($data,$oid);
|
||||
}
|
||||
// public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||
// StoreOrder::orderPostageAfter($data,$oid);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改发货状态 为发货
|
||||
@ -70,9 +70,9 @@ class StoreProductBehavior
|
||||
* @param $oid
|
||||
* $oid string store_order表中的id
|
||||
*/
|
||||
public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||
StoreOrder::orderPostageAfter($data,$oid);
|
||||
}
|
||||
// public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||
// StoreOrder::orderPostageAfter($data,$oid);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改状态 为已收货
|
||||
|
||||
58
extend/service/RoutineNotify.php
Normal file
58
extend/service/RoutineNotify.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace service;
|
||||
|
||||
/**
|
||||
* 小程序支付异步通知
|
||||
* Class RoutineNotify
|
||||
* @package service
|
||||
*/
|
||||
class RoutineNotify
|
||||
{
|
||||
public static function options(){
|
||||
$payment = SystemConfigService::more(['routine_appId','routine_appsecret','pay_routine_mchid','pay_routine_key']);
|
||||
return $payment;
|
||||
}
|
||||
public static function notify()
|
||||
{
|
||||
$config = self::options();
|
||||
$postStr = file_get_contents('php://input');
|
||||
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
if ($postObj === false) die('parse xml error');
|
||||
if ($postObj->return_code != 'SUCCESS') die($postObj->return_msg);
|
||||
if ($postObj->result_code != 'SUCCESS') die($postObj->err_code);
|
||||
$arr = (array)$postObj;
|
||||
unset($arr['sign']);
|
||||
if (self::getSign($arr, $config['pay_routine_key']) == $postObj->sign) {
|
||||
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取签名
|
||||
*/
|
||||
public static function getSign($params, $key)
|
||||
{
|
||||
ksort($params, SORT_STRING);
|
||||
$unSignParaString = self::formatQueryParaMap($params, false);
|
||||
$signStr = strtoupper(md5($unSignParaString . "&key=" . $key));
|
||||
return $signStr;
|
||||
}
|
||||
protected static function formatQueryParaMap($paraMap, $urlEncode = false)
|
||||
{
|
||||
$buff = "";
|
||||
ksort($paraMap);
|
||||
foreach ($paraMap as $k => $v) {
|
||||
if (null != $v && "null" != $v) {
|
||||
if ($urlEncode) {
|
||||
$v = urlencode($v);
|
||||
}
|
||||
$buff .= $k . "=" . $v . "&";
|
||||
}
|
||||
}
|
||||
$reqPar = '';
|
||||
if (strlen($buff) > 0) {
|
||||
$reqPar = substr($buff, 0, strlen($buff) - 1);
|
||||
}
|
||||
return $reqPar;
|
||||
}
|
||||
}
|
||||
@ -1127,7 +1127,7 @@ label.skin-lable{position:absolute;right:.24rem;top:.33rem;z-index:2}
|
||||
.template-pro-list .item-box ul li .pro-content .pro-infos .count{color:#999;font-size:.2rem}
|
||||
.buyspell-list .product-banner,.template-prolist .product-banner{width:100%;height:2.2rem}
|
||||
.buyspell-list .product-banner img,.template-prolist .product-banner img{display:block;width:100%;height:100%}
|
||||
.page-index .nav{width:100%;padding-bottom:.2rem;background-repeat:no-repeat;-webkit-background-size:100% auto;-moz-background-size:100% auto;background-size:100% auto}
|
||||
.page-index .nav{width:100%;padding-bottom:.2rem;background-repeat:no-repeat;-webkit-background-size:100% auto;-moz-background-size:100% auto;background-size:100% auto;padding: 0 .2rem;}
|
||||
.page-index .search-wrapper{z-index:99;width:100%;background:#fff}
|
||||
.page-index .search-wrapper .search-box{height:.8rem;padding:0 .2rem;-webkit-box-align:center;-moz-box-align:center;-o-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-moz-box-pack:justify;-o-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;background-color:#eb2f32}
|
||||
.page-index .search-wrapper .search-box input{width:5.3rem;height:.58rem;line-height:normal;border:1px solid rgba(255,255,255,.3);padding-left:.65rem;background-image:url(../../sx/images/search-icon.png);background-repeat:no-repeat;-webkit-background-size:.28rem .28rem;-moz-background-size:.28rem .28rem;background-size:.28rem .28rem;background-position:.2rem center;font-size:.22rem;border-radius:5px}
|
||||
@ -1137,7 +1137,7 @@ label.skin-lable{position:absolute;right:.24rem;top:.33rem;z-index:2}
|
||||
.page-index .nav{width:100%;padding-bottom:.2rem;background-repeat:no-repeat;-webkit-background-size:100% auto;-moz-background-size:100% auto;background-size:100% auto}
|
||||
.page-index .nav ul{-webkit-box-align:center;-moz-box-align:center;-o-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-lines:multiple;-moz-box-lines:multiple;-o-box-lines:multiple;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}
|
||||
.page-index .nav li{-webkit-box-flex:1;-moz-box-flex:1;-o-box-flex:1;box-flex:1;-webkit-flex:1 20%;-ms-flex:1 20%;flex:1 20%;margin-top:.2rem;text-align:center}
|
||||
.page-index .nav li img{width:.96rem;height:.96rem;border-radius:50%}
|
||||
.page-index .nav li img{width:.76rem;height:.76rem;border-radius:50%}
|
||||
.page-index .nav li p{margin-top:.1rem;font-size:.22rem}
|
||||
.common-slider-nav{background-color:#fff;overflow:hidden;font-size:.22rem}
|
||||
.common-slider-nav li{width:1.45rem;height:.68rem;line-height:.68rem;text-align:center}
|
||||
|
||||
24
vendor/composer/installed.json
vendored
24
vendor/composer/installed.json
vendored
@ -1111,23 +1111,23 @@
|
||||
},
|
||||
{
|
||||
"name": "tp5er/tp5-databackup",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tp5er/tp5-databackup.git",
|
||||
"reference": "101477abe810fb91bad5c1304a93c5f461db6dc8"
|
||||
"reference": "10abd4383cf78844e1c22584fd823ef1d18e75dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tp5er/tp5-databackup/zipball/101477abe810fb91bad5c1304a93c5f461db6dc8",
|
||||
"reference": "101477abe810fb91bad5c1304a93c5f461db6dc8",
|
||||
"url": "https://api.github.com/repos/tp5er/tp5-databackup/zipball/10abd4383cf78844e1c22584fd823ef1d18e75dc",
|
||||
"reference": "10abd4383cf78844e1c22584fd823ef1d18e75dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"time": "2018-04-07T11:20:53+00:00",
|
||||
"time": "2017-12-29T05:36:58+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
@ -1149,24 +1149,24 @@
|
||||
},
|
||||
{
|
||||
"name": "xaboy/form-builder",
|
||||
"version": "1.2.5",
|
||||
"version_normalized": "1.2.5.0",
|
||||
"version": "1.2.7",
|
||||
"version_normalized": "1.2.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xaboy/form-builder.git",
|
||||
"reference": "73cb5be3d9f57680f64d01ab424c4ac5c462f1b8"
|
||||
"reference": "43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/xaboy/form-builder/zipball/73cb5be3d9f57680f64d01ab424c4ac5c462f1b8",
|
||||
"reference": "73cb5be3d9f57680f64d01ab424c4ac5c462f1b8",
|
||||
"url": "https://api.github.com/repos/xaboy/form-builder/zipball/43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf",
|
||||
"reference": "43d5c0a8f1f1f0fc1f6430b827fbe2b7b0d5b5cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"time": "2018-11-13T12:44:31+00:00",
|
||||
"time": "2018-12-12T12:20:38+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
||||
14
vendor/tp5er/tp5-databackup/src/Backup.php
vendored
14
vendor/tp5er/tp5-databackup/src/Backup.php
vendored
@ -66,14 +66,14 @@ class Backup
|
||||
public function setTimeout($time=null)
|
||||
{
|
||||
if (!is_null($time)) {
|
||||
set_time_limit($time)||ini_set("max_execution_time", $time);
|
||||
set_time_limit($time)||ini_set("max_execution_time", $time);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* 设置数据库连接必备参数
|
||||
* @param array $dbconfig 数据库连接配置信息
|
||||
* @return object
|
||||
* @return object
|
||||
*/
|
||||
public function setDbConn($dbconfig = [])
|
||||
{
|
||||
@ -88,7 +88,7 @@ class Backup
|
||||
/**
|
||||
* 设置备份文件名
|
||||
* @param Array $file 文件名字
|
||||
* @return object
|
||||
* @return object
|
||||
*/
|
||||
public function setFile($file = null)
|
||||
{
|
||||
@ -118,7 +118,7 @@ class Backup
|
||||
if ($type) {
|
||||
$list = $db->query("SHOW FULL COLUMNS FROM {$table}");
|
||||
}else{
|
||||
$list = $db->query("show columns from {$table}");
|
||||
$list = $db->query("show columns from {$table}");
|
||||
}
|
||||
}
|
||||
return array_map('array_change_key_case', $list);
|
||||
@ -135,7 +135,7 @@ class Backup
|
||||
$glob = new \FilesystemIterator($path, $flag);
|
||||
$list = array();
|
||||
foreach ($glob as $name => $file) {
|
||||
$info['filename'] = $name;
|
||||
$info['filename'] = $name;//备份文件名称
|
||||
if (preg_match('/^\\d{8,8}-\\d{6,6}-\\d+\\.sql(?:\\.gz)?$/', $name)) {
|
||||
$name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
|
||||
$date = "{$name[0]}-{$name[1]}-{$name[2]}";
|
||||
@ -344,7 +344,7 @@ class Backup
|
||||
/**
|
||||
* 优化表
|
||||
* @param String $tables 表名
|
||||
* @return String $tables
|
||||
* @return String $tables
|
||||
*/
|
||||
public function optimize($tables = null)
|
||||
{
|
||||
@ -368,7 +368,7 @@ class Backup
|
||||
/**
|
||||
* 修复表
|
||||
* @param String $tables 表名
|
||||
* @return String $tables
|
||||
* @return String $tables
|
||||
*/
|
||||
public function repair($tables = null)
|
||||
{
|
||||
|
||||
11
vendor/xaboy/form-builder/README.md
vendored
11
vendor/xaboy/form-builder/README.md
vendored
@ -21,12 +21,21 @@
|
||||
PHP表单生成器,快速生成现代化的form表单。包含复选框、单选框、输入框、下拉选择框等元素以及省市区三级联动、时间选择、日期选择、颜色选择、树型、文件/图片上传等功能。
|
||||
</p>
|
||||
|
||||
> 1.2.4 版本支持简单字段验证
|
||||
> 1.2.4 版本支持字段验证
|
||||
|
||||
#### 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢!
|
||||
|
||||
#### 本项目还在不断开发完善中,如有建议或问题请[在这里提出](https://github.com/xaboy/form-builder/issues/new)
|
||||
|
||||
|
||||
## 更新说明
|
||||
|
||||
#### 1.2.7 (2018-12-12)
|
||||
- 完善时间选择组件,日期选择组件验证规则
|
||||
- 新增 fields 类型验证规则
|
||||
- 新增 使用 view 方法生成时,表单只能被创建一次
|
||||
- 修复一些小问题
|
||||
|
||||
## 安装
|
||||
`composer require xaboy/form-builder`
|
||||
|
||||
|
||||
68
vendor/xaboy/form-builder/src/Form.php
vendored
68
vendor/xaboy/form-builder/src/Form.php
vendored
@ -11,6 +11,7 @@ use FormBuilder\components\Cascader;
|
||||
use FormBuilder\components\FormStyle;
|
||||
use FormBuilder\components\Hidden;
|
||||
use FormBuilder\components\Row;
|
||||
use FormBuilder\exception\FormBuilderException;
|
||||
use FormBuilder\traits\form\FormCascaderTrait;
|
||||
use FormBuilder\traits\form\FormCheckBoxTrait;
|
||||
use FormBuilder\traits\form\FormColorPickerTrait;
|
||||
@ -33,6 +34,7 @@ use FormBuilder\traits\form\FormValidateTrait;
|
||||
|
||||
/**
|
||||
* Class Form
|
||||
*
|
||||
* @package FormBuilder
|
||||
*/
|
||||
class Form
|
||||
@ -59,12 +61,14 @@ class Form
|
||||
|
||||
/**
|
||||
* 三级联动 加载省市数据
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $loadCityData = false;
|
||||
|
||||
/**
|
||||
* 三级联动 加载省市区数据
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $loadCityAreaData = false;
|
||||
@ -96,18 +100,21 @@ class Form
|
||||
|
||||
/**
|
||||
* 加载 jquery
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $linkJq = true;
|
||||
|
||||
/**
|
||||
* 加载 vue
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $linkVue = true;
|
||||
|
||||
/**
|
||||
* 加载 iview
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $linkIview = true;
|
||||
@ -119,24 +126,28 @@ class Form
|
||||
|
||||
/**
|
||||
* 网页标题
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title = 'formBuilder';
|
||||
|
||||
/**
|
||||
* 提交地址
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $action = '';
|
||||
|
||||
/**
|
||||
* 表单id
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = '';
|
||||
|
||||
/**
|
||||
* 提交方式
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $method = 'post';
|
||||
@ -147,6 +158,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 表单配置
|
||||
*
|
||||
* @var array|mixed
|
||||
*/
|
||||
protected $config = [
|
||||
@ -162,8 +174,9 @@ class Form
|
||||
|
||||
/**
|
||||
* Form constructor.
|
||||
*
|
||||
* @param string $action 提交地址
|
||||
* @param array $components 组件
|
||||
* @param array $components 组件
|
||||
*/
|
||||
public function __construct($action = '', array $components = [])
|
||||
{
|
||||
@ -171,6 +184,11 @@ class Form
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public static function json()
|
||||
{
|
||||
return new Json();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $linkJq
|
||||
*/
|
||||
@ -217,7 +235,7 @@ class Form
|
||||
*/
|
||||
public function components(array $components = [])
|
||||
{
|
||||
foreach ($components as $component){
|
||||
foreach ($components as $component) {
|
||||
$this->append($component);
|
||||
}
|
||||
return $this;
|
||||
@ -254,6 +272,7 @@ class Form
|
||||
/**
|
||||
* 表单提交后成功执行的js地址
|
||||
* formCreate.formSuccess(formData,$f)
|
||||
*
|
||||
* @param string $successScript
|
||||
* @return $this
|
||||
*/
|
||||
@ -292,6 +311,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 提交地址
|
||||
*
|
||||
* @param string $action
|
||||
* @return $this
|
||||
*/
|
||||
@ -315,7 +335,7 @@ class Form
|
||||
*/
|
||||
public function getConfig($key = '')
|
||||
{
|
||||
if($key =='')
|
||||
if ($key == '')
|
||||
return $this->config;
|
||||
else
|
||||
return isset($this->config[$key]) ? $this->config[$key] : null;
|
||||
@ -323,6 +343,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 提交方式
|
||||
*
|
||||
* @param string $method
|
||||
* @return $this
|
||||
*/
|
||||
@ -334,6 +355,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
@ -354,13 +376,14 @@ class Form
|
||||
|
||||
/**
|
||||
* 追加组件
|
||||
*
|
||||
* @param FormComponentDriver $component
|
||||
* @return $this
|
||||
*/
|
||||
public function append(FormComponentDriver $component)
|
||||
{
|
||||
$field = $component->getField();
|
||||
if(!isset($this->components[$field]))
|
||||
if (!isset($this->components[$field]))
|
||||
$this->fields[] = $field;
|
||||
$this->components[$field] = $component;
|
||||
$this->checkLoadData($component);
|
||||
@ -369,13 +392,14 @@ class Form
|
||||
|
||||
/**
|
||||
* 开头插入组件
|
||||
*
|
||||
* @param FormComponentDriver $component
|
||||
* @return $this
|
||||
*/
|
||||
public function prepend(FormComponentDriver $component)
|
||||
{
|
||||
$field = $component->getField();
|
||||
if(!isset($this->components[$field]))
|
||||
if (!isset($this->components[$field]))
|
||||
array_unshift($this->fields, $field);
|
||||
$this->components[$field] = $component;
|
||||
$this->checkLoadData($component);
|
||||
@ -384,14 +408,15 @@ class Form
|
||||
|
||||
/**
|
||||
* 是否需要引入省市区数据
|
||||
*
|
||||
* @param FormComponentDriver $component
|
||||
*/
|
||||
protected function checkLoadData(FormComponentDriver $component)
|
||||
{
|
||||
if(
|
||||
if (
|
||||
$component instanceof Cascader
|
||||
&& ($this->loadCityData == false || $this->loadCityAreaData == false)
|
||||
){
|
||||
) {
|
||||
$type = $component->getType();
|
||||
if ($type == Cascader::TYPE_CITY)
|
||||
$this->loadCityData = true;
|
||||
@ -402,18 +427,26 @@ class Form
|
||||
|
||||
/**
|
||||
* 获得表单规则
|
||||
*
|
||||
* @return array
|
||||
* @throws FormBuilderException
|
||||
*/
|
||||
public function getRules()
|
||||
{
|
||||
$rules = [];
|
||||
$fields = [];
|
||||
foreach ($this->fields as $field) {
|
||||
$component = $this->components[$field];
|
||||
if (!($component instanceof FormComponentDriver))
|
||||
continue;
|
||||
$field = $component->getField();
|
||||
if (in_array($field, $fields))
|
||||
throw new FormBuilderException($field . '字段已重复,请保证组件 field 无重复');
|
||||
|
||||
$fields[] = $field;
|
||||
$rule = $component->build();
|
||||
if(!$component instanceof Hidden)
|
||||
$rule['validate'] = array_merge(isset($rule['validate']) ? $rule['validate'] : [],$component->validate()->build());
|
||||
if (!$component instanceof Hidden)
|
||||
$rule['validate'] = array_merge(isset($rule['validate']) ? $rule['validate'] : [], $component->validate()->build());
|
||||
$rules[] = $rule;
|
||||
}
|
||||
return $rules;
|
||||
@ -422,6 +455,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 获取表单视图
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function view()
|
||||
@ -435,6 +469,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 获取表单生成器所需全部js
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function script()
|
||||
@ -444,6 +479,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 获取生成表单的js代码
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function formScript()
|
||||
@ -458,6 +494,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 获取表单生成器所需js
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getScript()
|
||||
@ -470,19 +507,20 @@ class Form
|
||||
$script[] = $_script['city-area-data'];
|
||||
if ($this->loadCityData == true)
|
||||
$script[] = $_script['city-data'];
|
||||
if($this->linkJq)
|
||||
if ($this->linkJq)
|
||||
$script[] = $_script['jq'];
|
||||
if($this->linkIview){
|
||||
if ($this->linkIview) {
|
||||
$script[] = $_script['iview'];
|
||||
$script[] = $_script['iview-css'];
|
||||
}
|
||||
if($this->linkVue)
|
||||
if ($this->linkVue)
|
||||
$script[] = $_script['vue'];
|
||||
return array_reverse($script);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否隐藏提交按钮(默认显示)
|
||||
*
|
||||
* @param bool $isShow
|
||||
* @return Form
|
||||
*/
|
||||
@ -495,6 +533,7 @@ class Form
|
||||
|
||||
/**
|
||||
* 是否隐藏重置按钮(默认隐藏)
|
||||
*
|
||||
* @param bool $isShow
|
||||
* @return Form
|
||||
*/
|
||||
@ -523,12 +562,13 @@ class Form
|
||||
|
||||
/**
|
||||
* 生成表单快捷方法
|
||||
*
|
||||
* @param string $action
|
||||
* @param array $components
|
||||
* @param array $components
|
||||
* @return Form
|
||||
*/
|
||||
public static function create($action, array $components = [])
|
||||
{
|
||||
return new static($action, $components);
|
||||
return new self($action, $components);
|
||||
}
|
||||
}
|
||||
5
vendor/xaboy/form-builder/src/Helper.php
vendored
5
vendor/xaboy/form-builder/src/Helper.php
vendored
@ -8,6 +8,8 @@
|
||||
namespace FormBuilder;
|
||||
|
||||
|
||||
use FormBuilder\exception\FormBuilderException;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function toType($var, $type = 'string')
|
||||
@ -42,6 +44,7 @@ class Helper
|
||||
return "unknown type";
|
||||
}
|
||||
|
||||
|
||||
public static function verifyType($var, $verify, $title = '')
|
||||
{
|
||||
if (!is_array($verify)) $verify = [$verify];
|
||||
@ -51,7 +54,7 @@ class Helper
|
||||
}
|
||||
$type = self::getVarType($var);
|
||||
if (!in_array($type, $verify))
|
||||
throw new \Exception($title . '类型需为' . implode(',', $verify));
|
||||
throw new FormBuilderException($title . '类型需为' . implode(',', $verify));
|
||||
}
|
||||
|
||||
public static function getDate($date)
|
||||
|
||||
8
vendor/xaboy/form-builder/src/Json.php
vendored
8
vendor/xaboy/form-builder/src/Json.php
vendored
@ -17,22 +17,22 @@ class Json
|
||||
|
||||
public static function succ($msg, $data = [])
|
||||
{
|
||||
return static::result(200, $msg, $data);
|
||||
return self::result(200, $msg, $data);
|
||||
}
|
||||
|
||||
public static function fail($msg, $data = [])
|
||||
{
|
||||
return static::result(400, $msg, $data);
|
||||
return self::result(400, $msg, $data);
|
||||
}
|
||||
|
||||
public static function uploadSucc($filePath, $msg = '上传成功', $data = [])
|
||||
{
|
||||
$data['filePath'] = $filePath;
|
||||
return static::succ($msg, $data);
|
||||
return self::succ($msg, $data);
|
||||
}
|
||||
|
||||
public static function uploadFail($msg = '上传失败', $data = [])
|
||||
{
|
||||
return static::fail($msg, $data);
|
||||
return self::fail($msg, $data);
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 多级联动组件
|
||||
* Class Cascader
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) 数据类型, 支持 city_area(省市区三级联动), city (省市二级联动), other (自定义)
|
||||
* @method $this disabled(Boolean $bool) 是否禁用选择器
|
||||
@ -70,9 +71,6 @@ class Cascader extends FormComponentDriver
|
||||
'notFoundText' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$this->placeholder($this->getPlaceHolder());
|
||||
@ -96,13 +94,14 @@ class Cascader extends FormComponentDriver
|
||||
* "value":"东城区", "label":"东城区"
|
||||
* }]
|
||||
* }
|
||||
*
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function data(array $data)
|
||||
{
|
||||
if(!is_array($this->props['data'])) $this->props['data'] = [];
|
||||
$this->props['data'] = array_merge($this->props['data'],$data);
|
||||
if (!is_array($this->props['data'])) $this->props['data'] = [];
|
||||
$this->props['data'] = array_merge($this->props['data'], $data);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -112,12 +111,13 @@ class Cascader extends FormComponentDriver
|
||||
*/
|
||||
public function jsData($var)
|
||||
{
|
||||
$this->props['data'] = 'js.'.$var;
|
||||
$this->props['data'] = 'js.' . $var;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组件类型
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getType()
|
||||
@ -128,7 +128,7 @@ class Cascader extends FormComponentDriver
|
||||
/**
|
||||
* @return Validate
|
||||
*/
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::arr();
|
||||
}
|
||||
@ -145,7 +145,7 @@ class Cascader extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@ use FormBuilder\traits\component\ComponentOptionsTrait;
|
||||
/**
|
||||
* 复选框组件
|
||||
* Class Checkbox
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this size(String $size) 多选框组的尺寸,可选值为 large、small、default 或者不设置
|
||||
*/
|
||||
@ -36,7 +37,7 @@ class Checkbox extends FormComponentDriver
|
||||
* @var array
|
||||
*/
|
||||
protected static $propsRule = [
|
||||
'size'=>'string'
|
||||
'size' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -45,18 +46,18 @@ class Checkbox extends FormComponentDriver
|
||||
*/
|
||||
public function value($value)
|
||||
{
|
||||
if($value === null) return $this;
|
||||
if(!is_array($value))
|
||||
if ($value === null) return $this;
|
||||
if (!is_array($value))
|
||||
$this->value[] = (string)$value;
|
||||
else{
|
||||
foreach ($value as $v){
|
||||
$this->value[] = (string) $v;
|
||||
else {
|
||||
foreach ($value as $v) {
|
||||
$this->value[] = (string)$v;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::arr();
|
||||
}
|
||||
@ -67,23 +68,23 @@ class Checkbox extends FormComponentDriver
|
||||
public function build()
|
||||
{
|
||||
$options = [];
|
||||
foreach ($this->options as $option){
|
||||
foreach ($this->options as $option) {
|
||||
if ($option instanceof Option)
|
||||
$options[] = $option->build();
|
||||
}
|
||||
$value = array_unique($this->value);
|
||||
foreach ($value as $k=>$v){
|
||||
foreach ($value as $k => $v) {
|
||||
$value[$k] = (string)$v;
|
||||
}
|
||||
return [
|
||||
'type'=>$this->name,
|
||||
'field'=>$this->field,
|
||||
'title'=>$this->title,
|
||||
'value'=>$value,
|
||||
'props'=>(object)$this->props,
|
||||
'options'=>$options,
|
||||
'validate'=>$this->validate,
|
||||
'col'=>$this->col
|
||||
'type' => $this->name,
|
||||
'field' => $this->field,
|
||||
'title' => $this->title,
|
||||
'value' => $value,
|
||||
'props' => (object)$this->props,
|
||||
'options' => $options,
|
||||
'validate' => $this->validate,
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
18
vendor/xaboy/form-builder/src/components/Col.php
vendored
18
vendor/xaboy/form-builder/src/components/Col.php
vendored
@ -14,18 +14,19 @@ use FormBuilder\traits\component\CallPropsTrait;
|
||||
/**
|
||||
* col栅格规则
|
||||
* Class Col
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this span(Number $span) 栅格的占位格数,可选值为0~24的整数,为 0 时,相当于display:none
|
||||
* @method $this order(Number $order) 栅格的顺序,在flex布局模式下有效
|
||||
* @method $this offset(Number $offset) 栅格左侧的间隔格数,间隔内不可以有栅格
|
||||
* @method $this push(Number $push) 栅格向右移动格数
|
||||
* @method $this pull(Number $pull) 栅格向左移动格数
|
||||
* @method $this labelWidth(Number $labelWidth) 表单域标签的的宽度,默认150px
|
||||
* @method $this labelWidth(Number $labelWidth) 表单域标签的的宽度, 默认150px
|
||||
* @method $this className(String $className) 自定义的class名称
|
||||
* @method $this xs(Number|Col $span) <768px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this sm(Number|Col $span) ≥768px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this md(Number|Col $span) ≥992px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this lg(Number|Col $span) ≥1200px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this xs(Number | Col $span) <768px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this sm(Number | Col $span) ≥768px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this md(Number | Col $span) ≥992px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
* @method $this lg(Number | Col $span) ≥1200px 响应式栅格,可为栅格数或一个包含其他属性的对象
|
||||
*/
|
||||
class Col implements FormComponentInterFace
|
||||
{
|
||||
@ -56,10 +57,11 @@ class Col implements FormComponentInterFace
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $model = ['xs','sm','md','lg'];
|
||||
protected static $model = ['xs', 'sm', 'md', 'lg'];
|
||||
|
||||
/**
|
||||
* Col constructor.
|
||||
*
|
||||
* @param int $span
|
||||
*/
|
||||
public function __construct($span = 24)
|
||||
@ -72,8 +74,8 @@ class Col implements FormComponentInterFace
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
foreach (self::$model as $m){
|
||||
if(isset($this->props[$m]) && $this->props[$m] instanceof Col){
|
||||
foreach (self::$model as $m) {
|
||||
if (isset($this->props[$m]) && $this->props[$m] instanceof Col) {
|
||||
$this->props[$m] = $this->props[$m]->build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 颜色选择器组件
|
||||
* Class ColorPicker
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this disabled(Boolean $bool) 是否禁用
|
||||
* @method $this alpha(Boolean $bool) 是否支持透明度选择, 默认为false
|
||||
@ -50,6 +51,7 @@ class ColorPicker extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 自定义颜色预设
|
||||
*
|
||||
* @param $colors
|
||||
* @return $this
|
||||
*/
|
||||
@ -77,7 +79,7 @@ class ColorPicker extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 日期选择器组件
|
||||
* Class DatePicker
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) 显示类型,可选值为 date、daterange、datetime、datetimerange、year、month
|
||||
* @method $this format(String $format) 展示的日期格式, 默认为yyyy-MM-dd HH:mm:ss
|
||||
@ -67,7 +68,8 @@ class DatePicker extends FormComponentDriver
|
||||
*/
|
||||
protected $props = [
|
||||
'type' => self::TYPE_DATE,
|
||||
'editable' => false
|
||||
'editable' => false,
|
||||
'multiple' => false
|
||||
];
|
||||
|
||||
/**
|
||||
@ -86,7 +88,7 @@ class DatePicker extends FormComponentDriver
|
||||
'editable' => 'boolean',
|
||||
'transfer' => 'boolean',
|
||||
'splitPanels' => 'boolean',
|
||||
'showWeekNumbers' => 'boolean',
|
||||
'showWeekNumbers' => 'boolean'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -97,6 +99,22 @@ class DatePicker extends FormComponentDriver
|
||||
$this->placeholder($this->getPlaceHolder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启后, 可以选择多个日期, 仅在 date 下可用, 默认为false
|
||||
*
|
||||
* @param bool $bool
|
||||
* @return $this
|
||||
*/
|
||||
public function multiple($bool = true)
|
||||
{
|
||||
if ($this->props['type'] == 'date')
|
||||
$this->props['multiple'] = (bool)$bool;
|
||||
else
|
||||
$this->props['multiple'] = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return $this
|
||||
@ -116,12 +134,25 @@ class DatePicker extends FormComponentDriver
|
||||
|
||||
public function getValidateHandler()
|
||||
{
|
||||
if(in_array($this->props['type'],['datetimerange','daterange']))
|
||||
if (in_array($this->props['type'], ['datetimerange', 'daterange']) || $this->props['multiple'])
|
||||
return Validate::arr();
|
||||
else
|
||||
return Validate::date();
|
||||
}
|
||||
|
||||
public function required($message = null)
|
||||
{
|
||||
$message = $message ?: $this->getPlaceHolder();
|
||||
if (in_array($this->props['type'], ['datetimerange', 'daterange'])) {
|
||||
$this->validate()->fields([
|
||||
'0' => ['required' => true, 'type' => 'date', 'message' => $message],
|
||||
'1' => ['required' => true, 'type' => 'date', 'message' => $message]
|
||||
], true, $message);
|
||||
return $this;
|
||||
} else
|
||||
return parent::required($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@ -134,7 +165,7 @@ class DatePicker extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\traits\component\CallPropsTrait;
|
||||
/**
|
||||
* form表单样式
|
||||
* Class FormStyle
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this inline(Boolean $bool) 是否开启行内表单模式
|
||||
* @method $this labelPosition(String $labelPosition) 表单域标签的位置,可选值为 left、right、top
|
||||
@ -41,20 +42,22 @@ class FormStyle implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* FormStyle constructor.
|
||||
* @param bool $inline
|
||||
*
|
||||
* @param bool $inline
|
||||
* @param string $labelPosition
|
||||
* @param int $labelWidth
|
||||
* @param bool $showMessage
|
||||
* @param int $labelWidth
|
||||
* @param bool $showMessage
|
||||
* @param string $autocomplete
|
||||
*/
|
||||
public function __construct($inline = false, $labelPosition = 'right', $labelWidth = 125, $showMessage = true, $autocomplete = 'off')
|
||||
{
|
||||
$this->props = compact('inline','labelPosition','labelWidth','showMessage');
|
||||
$this->props = compact('inline', 'labelPosition', 'labelWidth', 'showMessage');
|
||||
$this->autocomplete($autocomplete);
|
||||
}
|
||||
|
||||
/**
|
||||
* 原生的 autocomplete 属性,可选值为 true = off 或 false = on
|
||||
*
|
||||
* @param bool $bool
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 框架组件
|
||||
* Class Frame
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) frame类型, 有input, file, image, 默认为input
|
||||
* @method $this src(String $src) iframe地址
|
||||
@ -90,7 +91,7 @@ class Frame extends FormComponentDriver
|
||||
$this->frameTitle($this->getPlaceHolder());
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::arr();
|
||||
}
|
||||
@ -111,7 +112,7 @@ class Frame extends FormComponentDriver
|
||||
'value' => $value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@ use FormBuilder\FormComponentDriver;
|
||||
/**
|
||||
* hidden组件
|
||||
* Class Hidden
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
*/
|
||||
class Hidden extends FormComponentDriver
|
||||
@ -25,6 +26,7 @@ class Hidden extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* Hidden constructor.
|
||||
*
|
||||
* @param String $field
|
||||
* @param String $value
|
||||
*/
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* Input组件,支持类型text、password、textarea、url、email、date
|
||||
* Class Input
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) 输入框类型,可选值为 text、password、textarea、url、email、date;
|
||||
* @method $this size(String $size) 输入框尺寸,可选值为large、small、default或者不设置;
|
||||
@ -102,7 +103,7 @@ class Input extends FormComponentDriver
|
||||
return parent::getPlaceHolder($pre);
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::str(Validate::TRIGGER_BLUR);
|
||||
}
|
||||
@ -110,6 +111,7 @@ class Input extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 自适应内容高度,仅在 textarea 类型下有效
|
||||
*
|
||||
* @param Bool|Number $minRows
|
||||
* @param null|Number $maxRows
|
||||
* @return $this
|
||||
@ -117,12 +119,13 @@ class Input extends FormComponentDriver
|
||||
public function autoSize($minRows = false, $maxRows = null)
|
||||
{
|
||||
|
||||
$this->props['autosize'] = $maxRows === null ? boolval($minRows) : compact('minRows', 'maxRows');
|
||||
$this->props['autosize'] = $maxRows === null ? boolval($minRows) : compact('minRows', 'maxRows');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成表单规则
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function build()
|
||||
@ -134,7 +137,7 @@ class Input extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@ use FormBuilder\FormComponentDriver;
|
||||
/**
|
||||
* 数字输入框组件
|
||||
* Class InputNumber
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this max(float $max) 最大值
|
||||
* @method $this min(float $min) 最小值
|
||||
@ -59,7 +60,7 @@ class InputNumber extends FormComponentDriver
|
||||
return parent::getPlaceHolder($pre);
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::num(Validate::TRIGGER_BLUR);
|
||||
}
|
||||
@ -76,7 +77,7 @@ class InputNumber extends FormComponentDriver
|
||||
'value' => $this->value === '' ? '' : (float)$this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ use FormBuilder\Helper;
|
||||
|
||||
/**
|
||||
* Class Option
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
*/
|
||||
class Option implements FormComponentInterFace
|
||||
@ -25,9 +26,11 @@ class Option implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* Option constructor.
|
||||
* @param $value
|
||||
*
|
||||
* @param $value
|
||||
* @param string $label
|
||||
* @param bool $disabled
|
||||
* @param bool $disabled
|
||||
* @throws \FormBuilder\exception\FormBuilderException
|
||||
*/
|
||||
public function __construct($value, $label = '', $disabled = false)
|
||||
{
|
||||
@ -40,6 +43,7 @@ class Option implements FormComponentInterFace
|
||||
/**
|
||||
* @param $value
|
||||
* @param $label
|
||||
* @throws \FormBuilder\exception\FormBuilderException
|
||||
*/
|
||||
public static function verify($value, $label)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ use FormBuilder\traits\component\ComponentOptionsTrait;
|
||||
/**
|
||||
* 单选框组件
|
||||
* Class Radio
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this size(String $size) 单选框的尺寸,可选值为 large、small、default 或者不设置
|
||||
* @method $this vertical(Boolean $bool) 是否垂直排列,按钮样式下无效
|
||||
@ -38,6 +39,7 @@ class Radio extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 使用按钮样式
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function button()
|
||||
@ -46,7 +48,7 @@ class Radio extends FormComponentDriver
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::str();
|
||||
}
|
||||
@ -69,7 +71,7 @@ class Radio extends FormComponentDriver
|
||||
'props' => (object)$this->props,
|
||||
'options' => $options,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@ use FormBuilder\FormComponentDriver;
|
||||
/**
|
||||
* 评分组件
|
||||
* Class Rate
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this count(int $star) star 总数, 默认为 5
|
||||
* @method $this allowHalf(Boolean $bool) 是否允许半选, 默认为 false
|
||||
@ -39,7 +40,7 @@ class Rate extends FormComponentDriver
|
||||
'clearable' => 'boolean',
|
||||
];
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::num();
|
||||
}
|
||||
@ -56,7 +57,7 @@ class Rate extends FormComponentDriver
|
||||
'value' => (float)$this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ use FormBuilder\traits\component\CallPropsTrait;
|
||||
/**
|
||||
* row栅格规则
|
||||
* Class Row
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this gutter(Number $gutter) 栅格间距,单位 px,左右平分
|
||||
* @method $this type(String $type) 栅格的顺序,在flex布局模式下有效
|
||||
@ -43,7 +44,8 @@ class Row implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* Row constructor.
|
||||
* @param int $gutter
|
||||
*
|
||||
* @param int $gutter
|
||||
* @param string $type
|
||||
* @param string $align
|
||||
* @param string $justify
|
||||
@ -51,7 +53,7 @@ class Row implements FormComponentInterFace
|
||||
*/
|
||||
public function __construct($gutter = 0, $type = '', $align = '', $justify = '', $className = '')
|
||||
{
|
||||
$this->props = compact('gutter','type','align','justify','className');
|
||||
$this->props = compact('gutter', 'type', 'align', 'justify', 'className');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -15,6 +15,7 @@ use FormBuilder\traits\component\ComponentOptionsTrait;
|
||||
/**
|
||||
* 选择器组件
|
||||
* Class Select
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this multiple(Boolean $bool) 是否支持多选, 默认为false
|
||||
* @method $this disabled(Boolean $bool) 是否禁用, 默认为false
|
||||
@ -63,9 +64,6 @@ class Select extends FormComponentDriver
|
||||
'notFoundText' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$this->placeholder($this->getPlaceHolder());
|
||||
@ -89,9 +87,9 @@ class Select extends FormComponentDriver
|
||||
}
|
||||
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
if($this->props['multiple'] == true)
|
||||
if ($this->props['multiple'] == true)
|
||||
return Validate::arr();
|
||||
else
|
||||
return Validate::str();
|
||||
@ -111,9 +109,9 @@ class Select extends FormComponentDriver
|
||||
$isArr = is_array($value);
|
||||
if ($this->props['multiple'] == false && $isArr)
|
||||
$value = isset($value[0]) ? $value[0] : '';
|
||||
else if($isArr){
|
||||
else if ($isArr) {
|
||||
$value = array_unique($value);
|
||||
foreach ($value as $k=>$v){
|
||||
foreach ($value as $k => $v) {
|
||||
$value[$k] = (string)$v;
|
||||
}
|
||||
}
|
||||
@ -125,7 +123,7 @@ class Select extends FormComponentDriver
|
||||
'props' => (object)$this->props,
|
||||
'options' => $options,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 滑块组件
|
||||
* Class Slider
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this min(float $min) 最小值, 默认 0
|
||||
* @method $this max(float $max) 最大值, 默认 100
|
||||
@ -65,9 +66,9 @@ class Slider extends FormComponentDriver
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
if($this->props['range'] == true)
|
||||
if ($this->props['range'] == true)
|
||||
return Validate::arr();
|
||||
else
|
||||
return Validate::num();
|
||||
@ -96,7 +97,7 @@ class Slider extends FormComponentDriver
|
||||
'value' => $value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ use FormBuilder\FormComponentDriver;
|
||||
/**
|
||||
* 开关组件
|
||||
* Class Switches
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this size(String $size) 开关的尺寸,可选值为large、small、default或者不写。建议开关如果使用了2个汉字的文字,使用 large。
|
||||
* @method $this disabled(Boolean $bool) 禁用开关, 默认为false
|
||||
@ -50,6 +51,7 @@ class Switches extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 自定义显示打开时的内容
|
||||
*
|
||||
* @param $open
|
||||
* @return $this
|
||||
*/
|
||||
@ -61,6 +63,7 @@ class Switches extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 自定义显示关闭时的内容
|
||||
*
|
||||
* @param $close
|
||||
* @return $this
|
||||
*/
|
||||
@ -70,7 +73,7 @@ class Switches extends FormComponentDriver
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
return Validate::str();
|
||||
}
|
||||
@ -88,7 +91,7 @@ class Switches extends FormComponentDriver
|
||||
'props' => (object)$this->props,
|
||||
'slot' => (object)$this->slot,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 时间选择器组件
|
||||
* Class TimePicker
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) 显示类型,可选值为 time、timerange
|
||||
* @method $this format(String $format) 展示的时间格式, 默认为HH:mm:ss
|
||||
@ -81,7 +82,8 @@ class TimePicker extends FormComponentDriver
|
||||
/**
|
||||
* 下拉列表的时间间隔,数组的三项分别对应小时、分钟、秒。
|
||||
* 例如设置为 [1, 15] 时,分钟会显示:00、15、30、45。
|
||||
* @param $h
|
||||
*
|
||||
* @param $h
|
||||
* @param int $i
|
||||
* @param int $s
|
||||
* @return $this
|
||||
@ -109,14 +111,28 @@ class TimePicker extends FormComponentDriver
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
if($this->props['type'] == 'timerange')
|
||||
if ($this->props['type'] == 'timerange')
|
||||
return Validate::arr();
|
||||
else
|
||||
return Validate::str();
|
||||
}
|
||||
|
||||
|
||||
public function required($message = null)
|
||||
{
|
||||
$message = $message ?: $this->getPlaceHolder();
|
||||
if ($this->props['type'] == 'timerange') {
|
||||
$this->validate()->fields([
|
||||
'0' => ['required' => true, 'message' => $message],
|
||||
'1' => ['required' => true, 'message' => $message]
|
||||
], true, $message);
|
||||
return $this;
|
||||
} else
|
||||
return parent::required($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@ -13,11 +13,12 @@ use FormBuilder\FormComponentDriver;
|
||||
/**
|
||||
* 树型组件
|
||||
* Class Tree
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this type(String $type) 类型,可选值为 checked、selected
|
||||
* @method $this multiple(Boolean $bool) 是否支持多选,当`type=selected`并且`multiple=false`,默认为false,值为String或Number类型,其他情况为Array类型
|
||||
* @method $this showCheckbox(Boolean $bool) 是否显示多选框,默认为false
|
||||
* @method $this emptyText(String $emptyText) 没有数据时的提示,默认为'暂无数据'
|
||||
* @method $this multiple(Boolean $bool) 是否支持多选, 当`type=selected`并且`multiple=false`, 默认为false, 值为String或Number类型,其他情况为Array类型
|
||||
* @method $this showCheckbox(Boolean $bool) 是否显示多选框, 默认为false
|
||||
* @method $this emptyText(String $emptyText) 没有数据时的提示, 默认为'暂无数据'
|
||||
*/
|
||||
class Tree extends FormComponentDriver
|
||||
{
|
||||
@ -41,7 +42,7 @@ class Tree extends FormComponentDriver
|
||||
protected $props = [
|
||||
'type' => self::TYPE_CHECKED,
|
||||
'data' => [],
|
||||
'multiple'=>true
|
||||
'multiple' => true
|
||||
];
|
||||
|
||||
/**
|
||||
@ -60,8 +61,8 @@ class Tree extends FormComponentDriver
|
||||
*/
|
||||
public function data(array $treeData)
|
||||
{
|
||||
if(!is_array($this->props['data'])) $this->props['data'] = [];
|
||||
foreach ($treeData as $child){
|
||||
if (!is_array($this->props['data'])) $this->props['data'] = [];
|
||||
foreach ($treeData as $child) {
|
||||
$this->props['data'][] = $child instanceof TreeData
|
||||
? $child->build()
|
||||
: $child;
|
||||
@ -75,7 +76,7 @@ class Tree extends FormComponentDriver
|
||||
*/
|
||||
public function jsData($var)
|
||||
{
|
||||
$this->props['data'] = 'js.'.$var;
|
||||
$this->props['data'] = 'js.' . $var;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -85,20 +86,20 @@ class Tree extends FormComponentDriver
|
||||
*/
|
||||
public function value($value)
|
||||
{
|
||||
if(is_array($value)){
|
||||
foreach ($value as $k=>$v){
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $k => $v) {
|
||||
$value[$k] = (string)$v;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$value = (string)$value;
|
||||
}
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getValidateHandler()
|
||||
public function getValidateHandler()
|
||||
{
|
||||
if($this->props['multiple'])
|
||||
if ($this->props['multiple'])
|
||||
return Validate::arr();
|
||||
else
|
||||
return Validate::str();
|
||||
@ -116,7 +117,7 @@ class Tree extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -13,11 +13,12 @@ use FormBuilder\traits\component\CallPropsTrait;
|
||||
|
||||
/**
|
||||
* Class TreeData
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this id(String $id) Id,必须唯一
|
||||
* @method $this id(String $id) Id, 必须唯一
|
||||
* @method $this title(String $title) 标题
|
||||
* @method $this expand(Boolean $bool) 是否展开直子节点,默认为false
|
||||
* @method $this disabled(Boolean $bool) 禁掉响应,默认为false
|
||||
* @method $this expand(Boolean $bool) 是否展开直子节点, 默认为false
|
||||
* @method $this disabled(Boolean $bool) 禁掉响应, 默认为false
|
||||
* @method $this disableCheckbox(Boolean $bool) 禁掉 checkbox
|
||||
* @method $this selected(Boolean $bool) 是否选中子节点
|
||||
* @method $this checked(Boolean $bool) 是否勾选(如果勾选,子节点也会全部勾选)
|
||||
@ -51,8 +52,9 @@ class TreeData implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* TreeData constructor.
|
||||
* @param $id
|
||||
* @param $title
|
||||
*
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param array $children
|
||||
*/
|
||||
public function __construct($id, $title, array $children = [])
|
||||
@ -68,7 +70,7 @@ class TreeData implements FormComponentInterFace
|
||||
*/
|
||||
public function children(array $children)
|
||||
{
|
||||
$this->children = array_merge($this->children,$children);
|
||||
$this->children = array_merge($this->children, $children);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ class TreeData implements FormComponentInterFace
|
||||
public function build()
|
||||
{
|
||||
$children = [];
|
||||
foreach ($this->children as $child){
|
||||
foreach ($this->children as $child) {
|
||||
$children[] = $child instanceof TreeData
|
||||
? $child->build()
|
||||
: $child;
|
||||
|
||||
@ -14,6 +14,7 @@ use FormBuilder\Helper;
|
||||
/**
|
||||
* 上传组件
|
||||
* Class Upload
|
||||
*
|
||||
* @package FormBuilder\components
|
||||
* @method $this uploadType(String $uploadType) 上传文件类型,可选值为 image(图片上传),file(文件上传)
|
||||
* @method $this action(String $action) 上传的地址
|
||||
@ -79,6 +80,7 @@ class Upload extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 设置上传的请求头部
|
||||
*
|
||||
* @param array $headers
|
||||
* @return $this
|
||||
*/
|
||||
@ -92,6 +94,7 @@ class Upload extends FormComponentDriver
|
||||
* 支持的文件类型,与 accept 不同的是,
|
||||
* format 是识别文件的后缀名,accept 为 input 标签原生的 accept 属性,
|
||||
* 会在选择文件时过滤,可以两者结合使用
|
||||
*
|
||||
* @param array $headers
|
||||
* @return $this
|
||||
*/
|
||||
@ -103,6 +106,7 @@ class Upload extends FormComponentDriver
|
||||
|
||||
/**
|
||||
* 上传时附带的额外参数
|
||||
*
|
||||
* @param array $headers
|
||||
* @return $this
|
||||
*/
|
||||
@ -112,7 +116,7 @@ class Upload extends FormComponentDriver
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getPlaceHolder($pre = '请上传')
|
||||
public function getPlaceHolder($pre = '请上传')
|
||||
{
|
||||
return parent::getPlaceHolder($pre);
|
||||
}
|
||||
@ -129,10 +133,7 @@ class Upload extends FormComponentDriver
|
||||
|
||||
protected function getValidateHandler()
|
||||
{
|
||||
if($this->props['maxLength'] == 1)
|
||||
return Validate::str();
|
||||
else
|
||||
return Validate::arr();
|
||||
return Validate::arr();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,7 +148,7 @@ class Upload extends FormComponentDriver
|
||||
'value' => $this->value,
|
||||
'props' => (object)$this->props,
|
||||
'validate' => $this->validate,
|
||||
'col'=>$this->col
|
||||
'col' => $this->col
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -39,61 +39,78 @@ class Validate implements FormComponentInterFace
|
||||
|
||||
public static function str($trigger = self::TRIGGER_CHANGE)
|
||||
{
|
||||
return new static(self::TYPE_STRING,$trigger);
|
||||
return new self(self::TYPE_STRING, $trigger);
|
||||
}
|
||||
|
||||
public static function arr($trigger = self::TRIGGER_CHANGE)
|
||||
{
|
||||
return new static(self::TYPE_ARRAY,$trigger);
|
||||
return new self(self::TYPE_ARRAY, $trigger);
|
||||
}
|
||||
|
||||
public static function num($trigger = self::TRIGGER_CHANGE)
|
||||
{
|
||||
return new static(self::TYPE_NUMBER,$trigger);
|
||||
return new self(self::TYPE_NUMBER, $trigger);
|
||||
}
|
||||
|
||||
public static function date($trigger = self::TRIGGER_CHANGE)
|
||||
{
|
||||
return new static(self::TYPE_DATE,$trigger);
|
||||
return new self(self::TYPE_DATE, $trigger);
|
||||
}
|
||||
|
||||
protected function set($validate, $message = null)
|
||||
public function set($validate, $message = null)
|
||||
{
|
||||
$this->validate[] = $validate + [
|
||||
'trigger' => $this->trigger,
|
||||
'type' => $this->type,
|
||||
'message' => $message
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function fields(array $fields, $required = null, $message = null)
|
||||
{
|
||||
$data = [];
|
||||
if (!is_null($required))
|
||||
$data['required'] = $required;
|
||||
if (is_null($message))
|
||||
$data['message'] = $message;
|
||||
$data['fields'] = (object)$fields;
|
||||
|
||||
return $this->set($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 必须为链接
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function url($message = null)
|
||||
{
|
||||
$this->set([
|
||||
'type'=>'url'
|
||||
],$message);
|
||||
'type' => 'url'
|
||||
], $message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 必须为邮箱
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function email($message = null)
|
||||
{
|
||||
$this->set([
|
||||
'type'=>'email'
|
||||
],$message);
|
||||
'type' => 'email'
|
||||
], $message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 必填
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
@ -107,6 +124,7 @@ class Validate implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* 长度或值必须在这个范围内
|
||||
*
|
||||
* @param int $min
|
||||
* @param int $max
|
||||
* @param string|null $message
|
||||
@ -123,6 +141,7 @@ class Validate implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* 长度或值必须大于这个值
|
||||
*
|
||||
* @param int $min
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
@ -137,6 +156,7 @@ class Validate implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* 长度或值必须小于这个值
|
||||
*
|
||||
* @param int $max
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
@ -151,6 +171,7 @@ class Validate implements FormComponentInterFace
|
||||
|
||||
/**
|
||||
* 长度或值必须等于这个值
|
||||
*
|
||||
* @param int $length
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
@ -158,13 +179,14 @@ class Validate implements FormComponentInterFace
|
||||
public function length($length, $message = null)
|
||||
{
|
||||
$this->set([
|
||||
'length' => (int)$length
|
||||
'len' => (int)$length
|
||||
], $message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 值必须在 list 中
|
||||
*
|
||||
* @param array $list
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
@ -172,7 +194,7 @@ class Validate implements FormComponentInterFace
|
||||
public function enum($list, $message = null)
|
||||
{
|
||||
$this->set([
|
||||
'type'=>'enum',
|
||||
'type' => 'enum',
|
||||
'enum' => (array)$list
|
||||
], $message);
|
||||
return $this;
|
||||
|
||||
20
vendor/xaboy/form-builder/src/exception/FormBuilderException.php
vendored
Normal file
20
vendor/xaboy/form-builder/src/exception/FormBuilderException.php
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: xaboy
|
||||
* Date: 2018/12/12
|
||||
* Time: 19:48
|
||||
*/
|
||||
|
||||
namespace FormBuilder\exception;
|
||||
|
||||
|
||||
use Throwable;
|
||||
|
||||
class FormBuilderException extends \Exception
|
||||
{
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ namespace FormBuilder\interfaces;
|
||||
|
||||
/**
|
||||
* Interface FormComponentInterFace
|
||||
*
|
||||
* @package FormBuilder\interfaces
|
||||
*/
|
||||
interface FormComponentInterFace
|
||||
@ -17,6 +18,7 @@ interface FormComponentInterFace
|
||||
|
||||
/**
|
||||
* 获取组件的生成规则
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function build();
|
||||
|
||||
@ -8,25 +8,28 @@
|
||||
namespace FormBuilder\traits\component;
|
||||
|
||||
|
||||
use FormBuilder\exception\FormBuilderException;
|
||||
use FormBuilder\Helper;
|
||||
|
||||
/**
|
||||
* Class CallPropsTrait
|
||||
*
|
||||
* @package FormBuilder\traits\component
|
||||
*/
|
||||
trait CallPropsTrait
|
||||
{
|
||||
/**
|
||||
* 设置组件属性
|
||||
*
|
||||
* @param $name
|
||||
* @param $arguments
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
* @throws FormBuilderException
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (isset(static::$propsRule[$name])) {
|
||||
if(static::$propsRule[$name] == ''){
|
||||
if (static::$propsRule[$name] == '') {
|
||||
$this->props[$name] = $arguments[0];
|
||||
} else if (is_array(static::$propsRule[$name])) {
|
||||
$this->props[static::$propsRule[$name][1]] = Helper::toType(
|
||||
@ -41,7 +44,7 @@ trait CallPropsTrait
|
||||
}
|
||||
return $this;
|
||||
} else {
|
||||
throw new \Exception($name . '方法不存在');
|
||||
throw new FormBuilderException($name . '方法不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ use FormBuilder\components\Option;
|
||||
|
||||
/**
|
||||
* Class ComponentOptionsTrait
|
||||
*
|
||||
* @package FormBuilder\traits\component
|
||||
*/
|
||||
trait ComponentOptionsTrait
|
||||
@ -23,10 +24,12 @@ trait ComponentOptionsTrait
|
||||
|
||||
/**
|
||||
* 设置的选项
|
||||
* @param $value
|
||||
* @param $label
|
||||
*
|
||||
* @param $value
|
||||
* @param $label
|
||||
* @param bool $disabled
|
||||
* @return $this
|
||||
* @throws \FormBuilder\exception\FormBuilderException
|
||||
*/
|
||||
public function option($value, $label, $disabled = false)
|
||||
{
|
||||
@ -37,9 +40,11 @@ trait ComponentOptionsTrait
|
||||
|
||||
/**
|
||||
* 批量设置的选项
|
||||
*
|
||||
* @param array $options
|
||||
* @param bool $disabled
|
||||
* @param bool $disabled
|
||||
* @return $this
|
||||
* @throws \FormBuilder\exception\FormBuilderException
|
||||
*/
|
||||
public function options(array $options, $disabled = false)
|
||||
{
|
||||
@ -59,16 +64,17 @@ trait ComponentOptionsTrait
|
||||
|
||||
/**
|
||||
* 批量设置选项 支持匿名函数
|
||||
* @param $options
|
||||
*
|
||||
* @param $options
|
||||
* @param bool $disabled
|
||||
* @return $this
|
||||
*/
|
||||
public function setOptions($options, $disabled = false)
|
||||
{
|
||||
if(is_callable($options))
|
||||
return $this->setOptions($options($this),$disabled);
|
||||
else if(is_array($options))
|
||||
return $this->options($options,$disabled);
|
||||
if (is_callable($options))
|
||||
return $this->setOptions($options($this), $disabled);
|
||||
else if (is_array($options))
|
||||
return $this->options($options, $disabled);
|
||||
else
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -12,15 +12,17 @@ use FormBuilder\components\Cascader;
|
||||
|
||||
/**
|
||||
* Class FormCascaderTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormCascaderTrait
|
||||
{
|
||||
/**
|
||||
* 多级联动组件
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @param string $type
|
||||
* @return Cascader
|
||||
*/
|
||||
@ -34,15 +36,16 @@ trait FormCascaderTrait
|
||||
|
||||
/**
|
||||
* 省市二级联动
|
||||
* @param $field
|
||||
* @param $title
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array|string $province
|
||||
* @param string $city
|
||||
* @param string $city
|
||||
* @return Cascader
|
||||
*/
|
||||
public static function city($field, $title, $province = [], $city = '')
|
||||
{
|
||||
if(is_array($province))
|
||||
if (is_array($province))
|
||||
$value = $province;
|
||||
else
|
||||
$value = [(string)$province, (string)$city];
|
||||
@ -55,16 +58,17 @@ trait FormCascaderTrait
|
||||
|
||||
/**
|
||||
* 省市区三级联动
|
||||
* @param $field
|
||||
* @param $title
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array|string $province
|
||||
* @param string $city
|
||||
* @param string $area
|
||||
* @param string $city
|
||||
* @param string $area
|
||||
* @return Cascader
|
||||
*/
|
||||
public static function cityArea($field, $title, $province = [], $city = '', $area = '')
|
||||
{
|
||||
if(is_array($province))
|
||||
if (is_array($province))
|
||||
$value = $province;
|
||||
else
|
||||
$value = [(string)$province, (string)$city, (string)$area];
|
||||
|
||||
@ -11,13 +11,16 @@ use FormBuilder\components\Checkbox;
|
||||
|
||||
/**
|
||||
* Class FormCheckBoxTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormCheckBoxTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 多选框组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @return Checkbox
|
||||
*/
|
||||
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\ColorPicker;
|
||||
|
||||
/**
|
||||
* Class FormColorPickerTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormColorPickerTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 颜色选择组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return ColorPicker
|
||||
*/
|
||||
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\DatePicker;
|
||||
|
||||
/**
|
||||
* Class FormDatePickerTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormDatePickerTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 日期组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
* @return DatePicker
|
||||
@ -31,8 +34,10 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 单选日期
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return DatePicker
|
||||
*/
|
||||
@ -42,8 +47,24 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 多选日期
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @return DatePicker
|
||||
*/
|
||||
public static function dateMultiple($field, $title, array $value)
|
||||
{
|
||||
$date = self::datePicker($field, $title, $value, DatePicker::TYPE_DATE);
|
||||
return $date->multiple();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期区间选择
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $startDate
|
||||
* @param string $endDate
|
||||
* @return DatePicker
|
||||
@ -54,8 +75,10 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 单选日期时间
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return DatePicker
|
||||
*/
|
||||
@ -65,8 +88,10 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 日期时间区间选择
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $startDate
|
||||
* @param string $endDate
|
||||
* @return DatePicker
|
||||
@ -77,8 +102,10 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 选择年
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return DatePicker
|
||||
*/
|
||||
@ -88,8 +115,10 @@ trait FormDatePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 选择月
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return DatePicker
|
||||
*/
|
||||
|
||||
@ -12,14 +12,17 @@ use FormBuilder\components\Frame;
|
||||
|
||||
/**
|
||||
* Class FormFrameTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormFrameTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 框架组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
* @return Frame
|
||||
@ -33,9 +36,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用input 类型显示,多选
|
||||
* value为Array类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param array $value
|
||||
* @return Frame
|
||||
*/
|
||||
@ -45,9 +51,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用文件类型显示,多选
|
||||
* value为Array类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param array $value
|
||||
* @return Frame
|
||||
*/
|
||||
@ -57,9 +66,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用文件类型显示,多选
|
||||
* value为Array类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param array $value
|
||||
* @return Frame
|
||||
*/
|
||||
@ -69,9 +81,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用input 类型显示,单选
|
||||
* value为String类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param string $value
|
||||
* @return Frame
|
||||
*/
|
||||
@ -81,9 +96,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用文件类型显示,单选
|
||||
* value为String类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param string $value
|
||||
* @return Frame
|
||||
*/
|
||||
@ -93,9 +111,12 @@ trait FormFrameTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* 使用文件类型显示,单选
|
||||
* value为String类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $src
|
||||
* @param string $value
|
||||
* @return Frame
|
||||
*/
|
||||
|
||||
@ -12,11 +12,14 @@ use FormBuilder\components\Hidden;
|
||||
|
||||
/**
|
||||
* Class FormHiddenTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormHiddenTrait
|
||||
{
|
||||
/**
|
||||
* 隐藏组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return Hidden
|
||||
|
||||
@ -12,14 +12,17 @@ use FormBuilder\components\InputNumber;
|
||||
|
||||
/**
|
||||
* Class FormInputNumberTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormInputNumberTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 数字输入框组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param null $value
|
||||
* @return InputNumber
|
||||
*/
|
||||
|
||||
@ -12,14 +12,16 @@ use FormBuilder\components\Input;
|
||||
|
||||
/**
|
||||
* Class FormInputTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormInputTrait
|
||||
{
|
||||
/**
|
||||
* 获取input组件
|
||||
* @param $field
|
||||
* @param $title
|
||||
* input输入框组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
* @return Input
|
||||
@ -32,8 +34,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* text 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
@ -43,8 +47,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* password 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
@ -54,8 +60,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* textarea 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
@ -65,8 +73,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* url 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
@ -76,8 +86,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* email 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
@ -87,8 +99,10 @@ trait FormInputTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* date 类型输入框
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Input
|
||||
*/
|
||||
|
||||
@ -12,18 +12,22 @@ use FormBuilder\components\Option;
|
||||
|
||||
/**
|
||||
* Class FormOptionTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormOptionTrait
|
||||
{
|
||||
/**
|
||||
* @param $value
|
||||
* 获取选择类组件 option 类
|
||||
*
|
||||
* @param $value
|
||||
* @param string $label
|
||||
* @param bool $disabled
|
||||
* @param bool $disabled
|
||||
* @return Option
|
||||
* @throws \FormBuilder\exception\FormBuilderException
|
||||
*/
|
||||
public static function option($value, $label = '', $disabled = false)
|
||||
{
|
||||
return new Option($value,$label,$disabled);
|
||||
return new Option($value, $label, $disabled);
|
||||
}
|
||||
}
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\Radio;
|
||||
|
||||
/**
|
||||
* Class FormRadioTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormRadioTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 单选框组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Radio
|
||||
*/
|
||||
|
||||
@ -12,17 +12,20 @@ use FormBuilder\components\Rate;
|
||||
|
||||
/**
|
||||
* Class FormRateTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormRateTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param number $value
|
||||
* 评分选择组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param float $value
|
||||
* @return Rate
|
||||
*/
|
||||
public static function rate($field, $title, $value = 0)
|
||||
public static function rate($field, $title, $value = 0.0)
|
||||
{
|
||||
return new Rate($field, $title, (float)$value);
|
||||
}
|
||||
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\Select;
|
||||
|
||||
/**
|
||||
* Class FormSelectTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormSelectTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 下拉选择组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Select
|
||||
*/
|
||||
@ -31,8 +34,10 @@ trait FormSelectTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 多选
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @return Select
|
||||
*/
|
||||
@ -42,8 +47,10 @@ trait FormSelectTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 单选
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Select
|
||||
*/
|
||||
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\Slider;
|
||||
|
||||
/**
|
||||
* Class FormSliderTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormSliderTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 滑块组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param int $value
|
||||
* @return Slider
|
||||
*/
|
||||
@ -28,8 +31,10 @@ trait FormSliderTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 区间选择
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param int $start
|
||||
* @param int $end
|
||||
* @return Slider
|
||||
|
||||
@ -14,12 +14,15 @@ use FormBuilder\components\Row;
|
||||
|
||||
/**
|
||||
* Class FormStyleTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormStyleTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* 组件布局规则类
|
||||
*
|
||||
* @param int $span
|
||||
* @return Col
|
||||
*/
|
||||
@ -29,7 +32,9 @@ trait FormStyleTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $gutter
|
||||
* 表格布局规则类
|
||||
*
|
||||
* @param int $gutter
|
||||
* @param string $type
|
||||
* @param string $align
|
||||
* @param string $justify
|
||||
@ -38,19 +43,21 @@ trait FormStyleTrait
|
||||
*/
|
||||
public static function row($gutter = 0, $type = '', $align = '', $justify = '', $className = '')
|
||||
{
|
||||
return new Row($gutter,$type,$align,$justify,$className);
|
||||
return new Row($gutter, $type, $align, $justify, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $inline
|
||||
* 表格样式类
|
||||
*
|
||||
* @param bool $inline
|
||||
* @param string $labelPosition
|
||||
* @param int $labelWidth
|
||||
* @param bool $showMessage
|
||||
* @param int $labelWidth
|
||||
* @param bool $showMessage
|
||||
* @param string $autocomplete
|
||||
* @return FormStyle
|
||||
*/
|
||||
public static function style($inline = false, $labelPosition = 'right', $labelWidth = 125, $showMessage = true, $autocomplete = 'off')
|
||||
{
|
||||
return new FormStyle($inline,$labelPosition,$labelWidth,$showMessage,$autocomplete);
|
||||
return new FormStyle($inline, $labelPosition, $labelWidth, $showMessage, $autocomplete);
|
||||
}
|
||||
}
|
||||
@ -12,13 +12,16 @@ use FormBuilder\components\Switches;
|
||||
|
||||
/**
|
||||
* Class FormSwitchesTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormSwitchesTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 开关组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @return Switches
|
||||
*/
|
||||
|
||||
@ -12,15 +12,18 @@ use FormBuilder\components\TimePicker;
|
||||
|
||||
/**
|
||||
* Class FormTimePickerTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormTimePickerTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
* 时间选择组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string|int $value
|
||||
* @param string $type
|
||||
* @return TimePicker
|
||||
*/
|
||||
public static function timePicker($field, $title, $value = '', $type = TimePicker::TYPE_TIME)
|
||||
@ -29,9 +32,11 @@ trait FormTimePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $value
|
||||
* 事件选择
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string|int $value
|
||||
* @return TimePicker
|
||||
*/
|
||||
public static function time($field, $title, $value = '')
|
||||
@ -40,10 +45,12 @@ trait FormTimePickerTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string $startTime
|
||||
* @param string $endTime
|
||||
* 时间区间选择
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param string|int $startTime
|
||||
* @param string|int $endTime
|
||||
* @return TimePicker
|
||||
*/
|
||||
public static function timeRange($field, $title, $startTime = '', $endTime = '')
|
||||
|
||||
@ -13,14 +13,17 @@ use FormBuilder\components\TreeData;
|
||||
|
||||
/**
|
||||
* Class FormTreeTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormTreeTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* 树形组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @param string $type
|
||||
* @return Tree
|
||||
*/
|
||||
@ -30,19 +33,23 @@ trait FormTreeTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 获取选中的值
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @return Tree
|
||||
*/
|
||||
public static function treeSelected($field, $title, $value = [])
|
||||
{
|
||||
return self::tree($field, $title, $value,Tree::TYPE_SELECTED);
|
||||
return self::tree($field, $title, $value, Tree::TYPE_SELECTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* 获取勾选的值
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param array $value
|
||||
* @return Tree
|
||||
*/
|
||||
@ -52,13 +59,15 @@ trait FormTreeTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $title
|
||||
* 树形组件数据 date 类
|
||||
*
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param array $children
|
||||
* @return TreeData
|
||||
*/
|
||||
public static function treeData($id, $title, array $children = [])
|
||||
{
|
||||
return new TreeData($id,$title,$children);
|
||||
return new TreeData($id, $title, $children);
|
||||
}
|
||||
}
|
||||
@ -12,14 +12,17 @@ use FormBuilder\components\Upload;
|
||||
|
||||
/**
|
||||
* Class FormUploadTrait
|
||||
*
|
||||
* @package FormBuilder\traits\form
|
||||
*/
|
||||
trait FormUploadTrait
|
||||
{
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* 上传组件
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
* @return Upload
|
||||
@ -32,24 +35,30 @@ trait FormUploadTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* 图片上传
|
||||
* value 为 Array类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* @param array $value
|
||||
* @return Upload
|
||||
*/
|
||||
public static function uploadImages($field, $title, $action, array $value = [])
|
||||
{
|
||||
$upload = self::upload($field, $title, $action, $value, Upload::TYPE_IMAGE);
|
||||
$upload->format(['jpg','jpeg','png','gif'])->accept('image/*');
|
||||
$upload->format(['jpg', 'jpeg', 'png', 'gif'])->accept('image/*');
|
||||
return $upload;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* 文件上传
|
||||
* value 为 Array类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* @param array $value
|
||||
* @return Upload
|
||||
*/
|
||||
@ -59,23 +68,29 @@ trait FormUploadTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* 图片上传
|
||||
* value 为 String类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* @param string $value
|
||||
* @return Upload
|
||||
*/
|
||||
public static function uploadImageOne($field, $title, $action, $value = '')
|
||||
{
|
||||
$upload = self::upload($field, $title, $action, $value, Upload::TYPE_IMAGE);
|
||||
$upload->format(['jpg','jpeg','png','gif'])->accept('image/*')->maxLength(1);
|
||||
$upload->format(['jpg', 'jpeg', 'png', 'gif'])->accept('image/*')->maxLength(1);
|
||||
return $upload;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* 文件上传
|
||||
* value 为 String类型
|
||||
*
|
||||
* @param $field
|
||||
* @param $title
|
||||
* @param $action
|
||||
* @param string $value
|
||||
* @return Upload
|
||||
*/
|
||||
|
||||
@ -12,36 +12,71 @@ use FormBuilder\components\Validate;
|
||||
|
||||
trait FormValidateTrait
|
||||
{
|
||||
/**
|
||||
* string 类型验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateStr()
|
||||
{
|
||||
return Validate::str();
|
||||
}
|
||||
|
||||
/**
|
||||
* input 组件验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateInput()
|
||||
{
|
||||
return Validate::str(Validate::TRIGGER_BLUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* array 类型验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateArr()
|
||||
{
|
||||
return Validate::arr();
|
||||
}
|
||||
|
||||
/**
|
||||
* number 类型验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateNum()
|
||||
{
|
||||
return Validate::num();
|
||||
}
|
||||
|
||||
/**
|
||||
* inputNumber 组件验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateNumInput()
|
||||
{
|
||||
return Validate::num(Validate::TRIGGER_BLUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* date 类型验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateDate()
|
||||
{
|
||||
return Validate::date();
|
||||
}
|
||||
|
||||
/**
|
||||
* frame 组件验证器
|
||||
*
|
||||
* @return Validate
|
||||
*/
|
||||
public static function validateFrame()
|
||||
{
|
||||
return self::ValidateArr();
|
||||
|
||||
@ -10,10 +10,12 @@
|
||||
});
|
||||
return rule;
|
||||
}, vm = new Vue,name = 'formBuilderExec<?= !$form->getId() ? '' : '_'.$form->getId() ?>';
|
||||
|
||||
var _b = false;
|
||||
window[name] = function create(el, callback) {
|
||||
if(_b) return ;
|
||||
_b = true;
|
||||
if (!el) el = document.body;
|
||||
$f = formCreate.create(getRule(), {
|
||||
var $f = formCreate.create(getRule(), {
|
||||
el: el,
|
||||
form:<?=json_encode($form->getConfig('form'))?>,
|
||||
row:<?=json_encode($form->getConfig('row'))?>,
|
||||
@ -48,12 +50,10 @@
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
vm.$Message.success(res.msg);
|
||||
$f.submitStatus({loading: false});
|
||||
formCreate.formSuccess && formCreate.formSuccess(res, $f, formData);
|
||||
callback && callback(0, res, $f, formData);
|
||||
//TODO 表单提交成功!
|
||||
} else {
|
||||
vm.$Message.error(res.msg);
|
||||
vm.$Message.error(res.msg || '表单提交失败');
|
||||
$f.btn.finish();
|
||||
callback && callback(1, res, $f, formData);
|
||||
//TODO 表单提交失败
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<view class='count-wrapper flex'>
|
||||
<view>原价:¥{{storeInfo.ot_price}}</view>
|
||||
<view>库存:{{storeInfo.stock}}{{storeInfo.unit_name}}</view>
|
||||
<view>销量:{{storeInfo.ficti}}{{storeInfo.unit_name}}</view>
|
||||
<view>销量:{{storeInfo.ficti+storeInfo.sales}}{{storeInfo.unit_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='block-bar' bindtap='goCoupon'>
|
||||
@ -78,7 +78,7 @@
|
||||
<view class='txt-msg'>{{reply.comment}}</view>
|
||||
<view class='time-bar'>{{reply.add_time}}</view>
|
||||
</view>
|
||||
<view wx:if="{{reply.merchant_reply_content != null}}">
|
||||
<view wx:if="{{reply.merchant_reply_content != ''}}">
|
||||
<view>管理员回复:</view>
|
||||
<view class='txt-msg'>{{reply.merchant_reply_content}}</view>
|
||||
<view class='time-bar'>{{reply.merchant_reply_time}}</view>
|
||||
|
||||
@ -56,6 +56,7 @@ background-color:#fff;padding:8rpx 0;border-radius:0;margin:0;line-height:2;}
|
||||
.poster-pop .close{width:46rpx;height:75rpx;position:fixed;right:0;top:-73rpx;}
|
||||
.poster-pop .save-poster{background-color:#df2d0a;font-size::22rpx;color:#fff;text-align:center;height:76rpx;line-height:76rpx;width:450rpx;}
|
||||
.mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.6);z-index:9;}
|
||||
.wxParse-p{margin-bottom: -5rpx;}
|
||||
@import "/pages/foo-tan/foo-tan.wxss";
|
||||
@import "/wxParse/wxParse.wxss";
|
||||
@import "/pages/home/home.wxss";
|
||||
@import "/pages/home/home.wxss";
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<view class='list-text {{_num==1?"list-text2":""}}'>{{item.store_name}}</view>
|
||||
<view class='list-money flex'>
|
||||
<view>
|
||||
<view class='list-num {{_num==1?"list-num2":""}}'>已售{{item.ficti}}</view>
|
||||
<view class='list-num {{_num==1?"list-num2":""}}'>已售{{item.ficti+item.sales}}</view>
|
||||
<view class='money-red'><text class='list-f'>¥</text><text class='money-num'>{{item.price}}</text><text class='list-oo'></text><text class='list-tip'>精</text></view>
|
||||
</view>
|
||||
<view class='iconfont icon-102 list-gwc {{_num==1?"list-gwc2":""}}' data-id="{{item.id}}" bindtap='cart' ></view>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user