后台功能提交

This commit is contained in:
焦钰锟 2025-04-28 18:02:15 +08:00
parent 463ec3b5e4
commit 618432bb36
28 changed files with 2522 additions and 1 deletions

View File

@ -0,0 +1,222 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品
* @author crud自动生成代码
* @date 2025/04/22
*/
namespace app\adminapi\controller\crud;
use app\adminapi\controller\AuthController;
use think\facade\App;
use app\services\crud\WebsiteProductsServices;
/**
* Class WebsiteProducts
* @date 2025/04/22
* @package app\adminapi\controller\crud
*/
class WebsiteProducts extends AuthController
{
/**
* @var WebsiteProductsServices
*/
protected $service;
/**
* WebsiteProductsController constructor.
* @param App $app
* @param WebsiteProductsServices $service
*/
public function __construct(App $app, WebsiteProductsServices $service)
{
parent::__construct($app);
$this->service = $service;
}
/**
* 列表
* @date 2025/04/22
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['title', ''],
['en_title', ''],
['profile', ''],
['en_profile', ''],
['content', ''],
['en_content', ''],
]);
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 创建
* @return \think\Response
* @date 2025/04/22
*/
public function create()
{
return app('json')->success($this->service->getCrudForm());
}
/**
* 保存
* @return \think\Response
* @date 2025/04/22
*/
public function save()
{
$data = $this->request->postMore([
['image', ''],
['images', ''],
['title', ''],
['en_title', ''],
['profile', ''],
['en_profile', ''],
['content', ''],
['en_content', ''],
['create_time', date('Y-m-d H:i:s')],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsValidate::class)->check($data);
$data['images'] = json_encode($data['images']);
$this->service->crudSave($data);
return app('json')->success(100021);
}
/**
* 编辑获取数据
* @param $id
* @return \think\Response
* @date 2025/04/22
*/
public function edit($id)
{
return app('json')->success($this->service->getCrudForm((int)$id));
}
/**
* 修改
* @param $id
* @return \think\Response
* @date 2025/04/22
*/
public function update($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['image', ''],
['images', ''],
['title', ''],
['en_title', ''],
['profile', ''],
['en_profile', ''],
['content', ''],
['en_content', ''],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsValidate::class)->check($data);
$data['images'] = json_encode($data['images']);
$this->service->crudUpdate((int)$id, $data);
return app('json')->success(100001);
}
/**
* 修改状态
* @param $id
* @return \think\Response
* @date 2025/04/22
*/
public function status($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['field', ''],
['value', '']
]);
$filedAll = [];
if (!in_array($data['field'], $filedAll)) {
return app('json')->fail(100100);
}
if ($this->service->update(['id'=> $id], [$data['field']=> $data['value']])) {
return app('json')->success(100001);
} else {
return app('json')->fail(100100);
}
}
/**
* 删除
* @param $id
* @return \think\Response
* @date 2025/04/22
*/
public function delete($id)
{
if (!$id) {
return app('json')->fail(100100);
}
if ($this->service->destroy((int)$id)) {
return app('json')->success(100002);
} else {
return app('json')->success(100008);
}
}
/**
* 查看
* @param $id
* @return \think\Response
* @date 2025/04/22
*/
public function read($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$info = $this->service->get($id, ['*','`images` as images_label'], []);
if (!$info) {
return app('json')->fail(100100);
}
return app('json')->success($info->toArray());
}
}

View File

@ -0,0 +1,199 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品分类
* @author crud自动生成代码
* @date 2025/04/28
*/
namespace app\adminapi\controller\crud;
use app\adminapi\controller\AuthController;
use think\facade\App;
use app\services\crud\WebsiteProductsCateServices;
/**
* Class WebsiteProductsCate
* @date 2025/04/28
* @package app\adminapi\controller\crud
*/
class WebsiteProductsCate extends AuthController
{
/**
* @var WebsiteProductsCateServices
*/
protected $service;
/**
* WebsiteProductsCateController constructor.
* @param App $app
* @param WebsiteProductsCateServices $service
*/
public function __construct(App $app, WebsiteProductsCateServices $service)
{
parent::__construct($app);
$this->service = $service;
}
/**
* 列表
* @date 2025/04/28
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['name', ''],
]);
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 创建
* @return \think\Response
* @date 2025/04/28
*/
public function create()
{
return app('json')->success($this->service->getCrudForm());
}
/**
* 保存
* @return \think\Response
* @date 2025/04/28
*/
public function save()
{
$data = $this->request->postMore([
['name', ''],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsCateValidate::class)->check($data);
$this->service->crudSave($data);
return app('json')->success(100021);
}
/**
* 编辑获取数据
* @param $id
* @return \think\Response
* @date 2025/04/28
*/
public function edit($id)
{
return app('json')->success($this->service->getCrudForm((int)$id));
}
/**
* 修改
* @param $id
* @return \think\Response
* @date 2025/04/28
*/
public function update($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['name', ''],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsCateValidate::class)->check($data);
$this->service->crudUpdate((int)$id, $data);
return app('json')->success(100001);
}
/**
* 修改状态
* @param $id
* @return \think\Response
* @date 2025/04/28
*/
public function status($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['field', ''],
['value', '']
]);
$filedAll = [];
if (!in_array($data['field'], $filedAll)) {
return app('json')->fail(100100);
}
if ($this->service->update(['id'=> $id], [$data['field']=> $data['value']])) {
return app('json')->success(100001);
} else {
return app('json')->fail(100100);
}
}
/**
* 删除
* @param $id
* @return \think\Response
* @date 2025/04/28
*/
public function delete($id)
{
if (!$id) {
return app('json')->fail(100100);
}
if ($this->service->destroy((int)$id)) {
return app('json')->success(100002);
} else {
return app('json')->success(100008);
}
}
/**
* 查看
* @param $id
* @return \think\Response
* @date 2025/04/28
*/
public function read($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$info = $this->service->get($id, ['*'], []);
if (!$info) {
return app('json')->fail(100100);
}
return app('json')->success($info->toArray());
}
}

View File

@ -0,0 +1,216 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 产品留言板
* @author crud自动生成代码
* @date 2025/04/21
*/
namespace app\adminapi\controller\crud;
use app\adminapi\controller\AuthController;
use think\facade\App;
use app\services\crud\WebsiteProductsMessageServices;
/**
* Class WebsiteProductsMessage
* @date 2025/04/21
* @package app\adminapi\controller\crud
*/
class WebsiteProductsMessage extends AuthController
{
/**
* @var WebsiteProductsMessageServices
*/
protected $service;
/**
* WebsiteProductsMessageController constructor.
* @param App $app
* @param WebsiteProductsMessageServices $service
*/
public function __construct(App $app, WebsiteProductsMessageServices $service)
{
parent::__construct($app);
$this->service = $service;
}
/**
* 列表
* @date 2025/04/21
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['product_id', ''],
['name', ''],
['emil', ''],
['mobile', ''],
['company', ''],
['subject', ''],
]);
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 创建
* @return \think\Response
* @date 2025/04/21
*/
public function create()
{
return app('json')->success($this->service->getCrudForm());
}
/**
* 保存
* @return \think\Response
* @date 2025/04/21
*/
public function save()
{
$data = $this->request->postMore([
['product_id', ''],
['name', ''],
['emil', ''],
['mobile', ''],
['company', ''],
['subject', ''],
['content', ''],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsMessageValidate::class)->check($data);
$this->service->crudSave($data);
return app('json')->success(100021);
}
/**
* 编辑获取数据
* @param $id
* @return \think\Response
* @date 2025/04/21
*/
public function edit($id)
{
return app('json')->success($this->service->getCrudForm((int)$id));
}
/**
* 修改
* @param $id
* @return \think\Response
* @date 2025/04/21
*/
public function update($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['product_id', ''],
['name', ''],
['emil', ''],
['mobile', ''],
['company', ''],
['subject', ''],
['content', ''],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsMessageValidate::class)->check($data);
$this->service->crudUpdate((int)$id, $data);
return app('json')->success(100001);
}
/**
* 修改状态
* @param $id
* @return \think\Response
* @date 2025/04/21
*/
public function status($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['field', ''],
['value', '']
]);
$filedAll = [];
if (!in_array($data['field'], $filedAll)) {
return app('json')->fail(100100);
}
if ($this->service->update(['id'=> $id], [$data['field']=> $data['value']])) {
return app('json')->success(100001);
} else {
return app('json')->fail(100100);
}
}
/**
* 删除
* @param $id
* @return \think\Response
* @date 2025/04/21
*/
public function delete($id)
{
if (!$id) {
return app('json')->fail(100100);
}
if ($this->service->destroy((int)$id)) {
return app('json')->success(100002);
} else {
return app('json')->success(100008);
}
}
/**
* 查看
* @param $id
* @return \think\Response
* @date 2025/04/21
*/
public function read($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$info = $this->service->get($id, ['*'], []);
if (!$info) {
return app('json')->fail(100100);
}
return app('json')->success($info->toArray());
}
}

View File

@ -173,7 +173,7 @@ class SystemCrud extends AuthController
if (!$data['tableName']) { if (!$data['tableName']) {
return app('json')->fail(500042); return app('json')->fail(500042);
} }
// var_dump($data);
$this->services->createCrud($id, $data); $this->services->createCrud($id, $data);
return app('json')->success(500043); return app('json')->success(500043);

View File

@ -0,0 +1,23 @@
<?php
use think\facade\Route;
Route::get('crud/website_products', 'crud.WebsiteProducts/index')->option(['real_name' => '网站产品列表接口']);
Route::get('crud/website_products/create', 'crud.WebsiteProducts/create')->option(['real_name' => '网站产品获取创建表单接口']);
Route::post('crud/website_products', 'crud.WebsiteProducts/save')->option(['real_name' => '网站产品保存接口']);
Route::get('crud/website_products/:id/edit', 'crud.WebsiteProducts/edit')->option(['real_name' => '网站产品获取修改表单接口']);
Route::put('crud/website_products/:id', 'crud.WebsiteProducts/update')->option(['real_name' => '网站产品修改接口']);
Route::put('crud/website_products/status/:id', 'crud.WebsiteProducts/status')->option(['real_name' => '网站产品修改状态接口']);
Route::delete('crud/website_products/:id', 'crud.WebsiteProducts/delete')->option(['real_name' => '网站产品删除接口']);
Route::get('crud/website_products/:id', 'crud.WebsiteProducts/read')->option(['real_name' => '网站产品查看接口']);

View File

@ -0,0 +1,23 @@
<?php
use think\facade\Route;
Route::get('crud/website_products_cate', 'crud.WebsiteProductsCate/index')->option(['real_name' => '网站产品分类列表接口']);
Route::get('crud/website_products_cate/create', 'crud.WebsiteProductsCate/create')->option(['real_name' => '网站产品分类获取创建表单接口']);
Route::post('crud/website_products_cate', 'crud.WebsiteProductsCate/save')->option(['real_name' => '网站产品分类保存接口']);
Route::get('crud/website_products_cate/:id/edit', 'crud.WebsiteProductsCate/edit')->option(['real_name' => '网站产品分类获取修改表单接口']);
Route::put('crud/website_products_cate/:id', 'crud.WebsiteProductsCate/update')->option(['real_name' => '网站产品分类修改接口']);
Route::put('crud/website_products_cate/status/:id', 'crud.WebsiteProductsCate/status')->option(['real_name' => '网站产品分类修改状态接口']);
Route::delete('crud/website_products_cate/:id', 'crud.WebsiteProductsCate/delete')->option(['real_name' => '网站产品分类删除接口']);
Route::get('crud/website_products_cate/:id', 'crud.WebsiteProductsCate/read')->option(['real_name' => '网站产品分类查看接口']);

View File

@ -0,0 +1,23 @@
<?php
use think\facade\Route;
Route::get('crud/website_products_message', 'crud.WebsiteProductsMessage/index')->option(['real_name' => '产品留言板列表接口']);
Route::get('crud/website_products_message/create', 'crud.WebsiteProductsMessage/create')->option(['real_name' => '产品留言板获取创建表单接口']);
Route::post('crud/website_products_message', 'crud.WebsiteProductsMessage/save')->option(['real_name' => '产品留言板保存接口']);
Route::get('crud/website_products_message/:id/edit', 'crud.WebsiteProductsMessage/edit')->option(['real_name' => '产品留言板获取修改表单接口']);
Route::put('crud/website_products_message/:id', 'crud.WebsiteProductsMessage/update')->option(['real_name' => '产品留言板修改接口']);
Route::put('crud/website_products_message/status/:id', 'crud.WebsiteProductsMessage/status')->option(['real_name' => '产品留言板修改状态接口']);
Route::delete('crud/website_products_message/:id', 'crud.WebsiteProductsMessage/delete')->option(['real_name' => '产品留言板删除接口']);
Route::get('crud/website_products_message/:id', 'crud.WebsiteProductsMessage/read')->option(['real_name' => '产品留言板查看接口']);

View File

@ -0,0 +1,53 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品分类
* @author crud自动生成代码
* @date 2025/04/28 16:44:50
*/
namespace app\adminapi\validate\crud;
use think\Validate;
/**
* Class CrudValidate
* @date 2025/04/28
* @package app\adminapi\validate\crud
*/
class WebsiteProductsCateValidate extends Validate
{
/**
* @var array
*/
protected $rule = [
'name'=> 'require',
];
/**
* @var array
*/
protected $message = [
'name.require'=> '分类名称必须填写',
];
/**
* @var array
*/
protected $scene = [
];
}

View File

@ -0,0 +1,57 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 产品留言板
* @author crud自动生成代码
* @date 2025/04/21 15:07:45
*/
namespace app\adminapi\validate\crud;
use think\Validate;
/**
* Class CrudValidate
* @date 2025/04/21
* @package app\adminapi\validate\crud
*/
class WebsiteProductsMessageValidate extends Validate
{
/**
* @var array
*/
protected $rule = [
'product_id'=> 'require',
'name'=> 'require',
'mobile'=> 'require',
];
/**
* @var array
*/
protected $message = [
'product_id.require'=> '留言产品必须填写',
'name.require'=> '姓名必须填写',
'mobile.require'=> '电话必须填写',
];
/**
* @var array
*/
protected $scene = [
];
}

View File

@ -0,0 +1,67 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品
* @author crud自动生成代码
* @date 2025/04/22 11:27:33
*/
namespace app\adminapi\validate\crud;
use think\Validate;
/**
* Class CrudValidate
* @date 2025/04/22
* @package app\adminapi\validate\crud
*/
class WebsiteProductsValidate extends Validate
{
/**
* @var array
*/
protected $rule = [
'image'=> 'require',
'images'=> 'require',
'title'=> 'require',
'en_title'=> 'require',
'profile'=> 'require',
'en_profile'=> 'require',
'content'=> 'require',
'en_content'=> 'require',
];
/**
* @var array
*/
protected $message = [
'image.require'=> '列表头图必须填写',
'images.require'=> '轮播图必须填写',
'title.require'=> '标题必须填写',
'en_title.require'=> '英文标题必须填写',
'profile.require'=> '简介必须填写',
'en_profile.require'=> '英文简介必须填写',
'content.require'=> '产品详情必须填写',
'en_content.require'=> '英文产品详情必须填写',
];
/**
* @var array
*/
protected $scene = [
];
}

View File

@ -0,0 +1,53 @@
<?php
namespace app\api\controller\v1\publics;
use app\services\crud\WebsiteProductsServices;
class WebsiteProductController
{
/**
* @var WebsiteProductsServices
*/
protected $service;
/**
* ProcessController constructor.
* @param WebsiteProductsServices $service
*/
public function __construct(WebsiteProductsServices $service)
{
$this->service = $service;
}
/**
* 列表
* @date 2025/02/21
* @return \think\Response
*/
public function lst()
{
$where = [];
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 详情
* @param $id
* @return mixed
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function details($id)
{
$info = $this->service->getInfo($id);
return app('json')->success($info);
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace app\api\controller\v1\publics;
use app\Request;
use app\services\crud\WebsiteProductsMessageServices;
class WebsiteProductMessageController
{
/**
* @var WebsiteProductsMessageServices
*/
protected $service;
/**
* ProcessController constructor.
* @param WebsiteProductsMessageServices $service
*/
public function __construct(WebsiteProductsMessageServices $service)
{
$this->service = $service;
}
/**
* 产品留言
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function leave_word(Request $request)
{
$data = $request->postMore([
['name', ''], //姓名
['product_id', 0],//留言产品
['emil', ''], //电子邮箱
['mobile', ''], //电话
['company', ''], //公司
['subject', ''], //主题
['content', ''],
['create_time', date('Y-m-d H:i:s')],
]);
validate(\app\adminapi\validate\crud\WebsiteProductsMessageValidate::class)->check($data);
$this->service->crudSave($data);
return app('json')->success(100021);
}
}

View File

@ -79,6 +79,16 @@ Route::group(function () {
})->option(['parent' => 'activity_nologin', 'cate_name' => '公司历程']); })->option(['parent' => 'activity_nologin', 'cate_name' => '公司历程']);
Route::group(function () {
//文章分类类
Route::get('websiteproduct/list', 'v1.publics.WebsiteProductController/lst')->name('websiteproductList')->option(['real_name' => '官网产品列表']);//文章分类列表
Route::get('websiteproduct/details/:id', 'v1.publics.WebsiteProductController/details')->name('websiteproductDetails')->option(['real_name' => '官网产品详情']);//文章详情
Route::post('websiteproduct/leave_word', 'v1.publics.WebsiteProductMessageController/leave_word')->option(['real_name' => '官网产品留言保存接口']);
})->option(['parent' => 'activity_nologin', 'cate_name' => '网站产品']);
})->option(['mark' => 'web_site_info', 'mark_name' => '官网']); })->option(['mark' => 'web_site_info', 'mark_name' => '官网']);

View File

@ -0,0 +1,61 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品分类
* @author crud自动生成代码
* @date 2025/04/28 16:44:50
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\WebsiteProductsCate;
/**
* Class WebsiteProductsCateDao
* @date 2025/04/28
* @package app\dao\crud
*/
class WebsiteProductsCateDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2025/04/28
*/
protected function setModel(): string
{
return WebsiteProductsCate::class;
}
/**
* 搜索
* @param array $where
* @return \crmeb\basic\BaseModel
* @throws \ReflectionException
* @date {%DATE%}
*/
public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
{
return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
$query->order($order);
})->when($with, function ($query) use ($with) {
$query->with($with);
})->when(!empty($where['name']), function($query) use ($where) {
$query->whereLike('name', '%'.$where['name'].'%');
});
}
}

View File

@ -0,0 +1,89 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品
* @author crud自动生成代码
* @date 2025/04/22 11:27:33
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\WebsiteProducts;
use think\exception\ValidateException;
/**
* Class WebsiteProductsDao
* @date 2025/04/22
* @package app\dao\crud
*/
class WebsiteProductsDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2025/04/22
*/
protected function setModel(): string
{
return WebsiteProducts::class;
}
/**
* 获取一条数据
* @param $id
* @return mixed
*/
public function read($id)
{
$data = $this->search()->find($id);
if (!$data) throw new ValidateException('文章不存在');
// $data['store_info'] = $data['storeInfo'];
return $data;
}
/**
* 搜索
* @param array $where
* @return \crmeb\basic\BaseModel
* @throws \ReflectionException
* @date {%DATE%}
*/
public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
{
return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
$query->order($order);
})->when($with, function ($query) use ($with) {
$query->with($with);
})->when(!empty($where['title']), function($query) use ($where) {
$query->whereLike('title', '%'.$where['title'].'%');
})->when(!empty($where['en_title']), function($query) use ($where) {
$query->whereLike('en_title', '%'.$where['en_title'].'%');
})->when(!empty($where['profile']), function($query) use ($where) {
$query->whereLike('profile', '%'.$where['profile'].'%');
})->when(!empty($where['en_profile']), function($query) use ($where) {
$query->whereLike('en_profile', '%'.$where['en_profile'].'%');
})->when(!empty($where['content']), function($query) use ($where) {
$query->whereLike('content', '%'.$where['content'].'%');
})->when(!empty($where['en_content']), function($query) use ($where) {
$query->whereLike('en_content', '%'.$where['en_content'].'%');
});
}
}

View File

@ -0,0 +1,71 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 产品留言板
* @author crud自动生成代码
* @date 2025/04/21 15:07:45
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\WebsiteProductsMessage;
/**
* Class WebsiteProductsMessageDao
* @date 2025/04/21
* @package app\dao\crud
*/
class WebsiteProductsMessageDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2025/04/21
*/
protected function setModel(): string
{
return WebsiteProductsMessage::class;
}
/**
* 搜索
* @param array $where
* @return \crmeb\basic\BaseModel
* @throws \ReflectionException
* @date {%DATE%}
*/
public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
{
return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
$query->order($order);
})->when($with, function ($query) use ($with) {
$query->with($with);
})->when(!empty($where['product_id']), function($query) use ($where) {
$query->where('product_id', '=', $where['product_id']);
})->when(!empty($where['name']), function($query) use ($where) {
$query->whereLike('name', '%'.$where['name'].'%');
})->when(!empty($where['emil']), function($query) use ($where) {
$query->whereLike('emil', '%'.$where['emil'].'%');
})->when(!empty($where['mobile']), function($query) use ($where) {
$query->whereLike('mobile', '%'.$where['mobile'].'%');
})->when(!empty($where['company']), function($query) use ($where) {
$query->whereLike('company', '%'.$where['company'].'%');
})->when(!empty($where['subject']), function($query) use ($where) {
$query->whereLike('subject', '%'.$where['subject'].'%');
});
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品
* @author crud自动生成代码
* @date 2025/04/22 11:27:33
*/
namespace app\model\crud;
use crmeb\basic\BaseModel;
/**
* Class WebsiteProducts
* @date 2025/04/22
* @package app\model\crud
*/
class WebsiteProducts extends BaseModel
{
/**
* 表名
* @var string
*/
protected $name = 'website_products';
/**
* 主键
* @var string
*/
protected $pk = 'id';
/**
* 轮播图获取器
* @date 2025-04-22
* @param string $value
* @return string
*/
public function getImagesLabelAttr($value)
{
$value = $value ? json_decode($value, true) : [];
return $value;
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品分类
* @author crud自动生成代码
* @date 2025/04/28 16:44:50
*/
namespace app\model\crud;
use crmeb\basic\BaseModel;
/**
* Class WebsiteProductsCate
* @date 2025/04/28
* @package app\model\crud
*/
class WebsiteProductsCate extends BaseModel
{
/**
* 表名
* @var string
*/
protected $name = 'website_products_cate';
/**
* 主键
* @var string
*/
protected $pk = 'id';
}

View File

@ -0,0 +1,56 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 产品留言板
* @author crud自动生成代码
* @date 2025/04/21 15:07:45
*/
namespace app\model\crud;
use crmeb\basic\BaseModel;
/**
* Class WebsiteProductsMessage
* @date 2025/04/21
* @package app\model\crud
*/
class WebsiteProductsMessage extends BaseModel
{
/**
* 表名
* @var string
*/
protected $name = 'website_products_message';
/**
* 主键
* @var string
*/
protected $pk = 'id';
/**
* 留言产品一对一关联
* @date 2025/04/21
* @return \think\model\relation\HasOne
*/
public function productIdHasOne()
{
return $this->hasOne(\app\model\crud\WebsiteProducts::class, 'id', 'product_id');
}
}

View File

@ -0,0 +1,107 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品分类
* @author crud自动生成代码
* @date 2025/04/28 16:44:50
*/
namespace app\services\crud;
use app\services\BaseServices;
use think\exception\ValidateException;
use app\dao\crud\WebsiteProductsCateDao;
use crmeb\services\FormBuilder;
/**
* Class CrudService
* @date 2025/04/28
* @package app\services\crud
*/
class WebsiteProductsCateServices extends BaseServices
{
/**
* WebsiteProductsCateServices constructor.
* @param WebsiteProductsCateDao $dao
*/
public function __construct(WebsiteProductsCateDao $dao)
{
$this->dao = $dao;
}
/**
* 主页数据接口
* @param array $where
* @return array
* @date 2025/04/28
*/
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'name,id', 'id desc', []);
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}
/**
* 编辑和获取表单
* @date 2025/04/28
* @param int $id
* @return array
*/
public function getCrudForm(int $id = 0)
{
$url = '/crud/website_products_cate';
$info = [];
if ($id) {
$info = $this->dao->get($id);
if (!$info) {
throw new ValidateException(100026);
}
$url .= '/' . $id;
}
$rule = [];
$rule[] = FormBuilder::input("name", "分类名称", $info["name"] ?? '');
return create_form('网站产品分类', $rule, $url, $id ? 'PUT' : 'POST');
}
/**
* 新增
* @date 2025/04/28
* @param array $data
* @return mixed
*/
public function crudSave(array $data)
{
return $this->dao->save($data);
}
/**
* 修改
* @date 2025/04/28
* @param int $id
* @param array $data
* @return \crmeb\basic\BaseModel
*/
public function crudUpdate(int $id, array $data)
{
return $this->dao->update($id, $data);
}
}

View File

@ -0,0 +1,113 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 产品留言板
* @author crud自动生成代码
* @date 2025/04/21 15:07:45
*/
namespace app\services\crud;
use app\services\BaseServices;
use think\exception\ValidateException;
use app\dao\crud\WebsiteProductsMessageDao;
use crmeb\services\FormBuilder;
/**
* Class CrudService
* @date 2025/04/21
* @package app\services\crud
*/
class WebsiteProductsMessageServices extends BaseServices
{
/**
* WebsiteProductsMessageServices constructor.
* @param WebsiteProductsMessageDao $dao
*/
public function __construct(WebsiteProductsMessageDao $dao)
{
$this->dao = $dao;
}
/**
* 主页数据接口
* @param array $where
* @return array
* @date 2025/04/21
*/
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'product_id,name,emil,mobile,company,subject,id', 'id desc', ['productIdHasOne']);
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}
/**
* 编辑和获取表单
* @date 2025/04/21
* @param int $id
* @return array
*/
public function getCrudForm(int $id = 0)
{
$url = '/crud/website_products_message';
$info = [];
if ($id) {
$info = $this->dao->get($id);
if (!$info) {
throw new ValidateException(100026);
}
$url .= '/' . $id;
}
$rule = [];
$rule[] = FormBuilder::number("product_id", "留言产品", $info["product_id"] ?? '');
$rule[] = FormBuilder::input("name", "姓名", $info["name"] ?? '');
$rule[] = FormBuilder::input("emil", "电子邮箱", $info["emil"] ?? '');
$rule[] = FormBuilder::input("mobile", "电话", $info["mobile"] ?? '');
$rule[] = FormBuilder::input("company", "公司", $info["company"] ?? '');
$rule[] = FormBuilder::input("subject", "主题", $info["subject"] ?? '');
$rule[] = FormBuilder::textarea("content", "内容", $info["content"] ?? '');
return create_form('产品留言板', $rule, $url, $id ? 'PUT' : 'POST');
}
/**
* 新增
* @date 2025/04/21
* @param array $data
* @return mixed
*/
public function crudSave(array $data)
{
return $this->dao->save($data);
}
/**
* 修改
* @date 2025/04/21
* @param int $id
* @param array $data
* @return \crmeb\basic\BaseModel
*/
public function crudUpdate(int $id, array $data)
{
return $this->dao->update($id, $data);
}
}

View File

@ -0,0 +1,150 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 网站产品
* @author crud自动生成代码
* @date 2025/04/22 11:27:33
*/
namespace app\services\crud;
use app\services\BaseServices;
use crmeb\exceptions\AdminException;
use think\exception\ValidateException;
use app\dao\crud\WebsiteProductsDao;
use crmeb\services\FormBuilder;
/**
* Class CrudService
* @date 2025/04/22
* @package app\services\crud
*/
class WebsiteProductsServices extends BaseServices
{
/**
* WebsiteProductsServices constructor.
* @param WebsiteProductsDao $dao
*/
public function __construct(WebsiteProductsDao $dao)
{
$this->dao = $dao;
}
/**获取一条数据
* @param int $id
* @return mixed
*/
public function getInfo(int $id)
{
$info = $this->dao->read($id);
// $info->visit = intval($info['visit']) + 1;
// if (!$info->save())
// throw new AdminException(400456);
if ($info) {
$info = $info->toArray();
$info['images'] = json_decode($info['images'], true);
// $info['visit'] = (int)$info['visit'];
// $info['add_time'] = date('Y-m-d', $info['add_time']);
}
return $info;
}
/**
* 主页数据接口
* @param array $where
* @return array
* @date 2025/04/22
*/
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'image,`images` as images_label,title,en_title,id', 'id desc', []);
// $list = $model->page($page ?: 1, $limit ?: 10)->select()->toArray();
// foreach ($list as &$item){
//
// $item['images'] = json_decode($item['images_label'], true);
// }
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}
/**
* 编辑和获取表单
* @date 2025/04/22
* @param int $id
* @return array
*/
public function getCrudForm(int $id = 0)
{
$url = '/crud/website_products';
$info = [];
if ($id) {
$info = $this->dao->get($id);
if (!$info) {
throw new ValidateException(100026);
}
$url .= '/' . $id;
}
$rule = [];
$rule[] = FormBuilder::frameImage('image', '列表头图', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'image']), $info['image'] ?? '')->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false]);
if (isset($info['images'])) {
$pics = is_array($info['images']) ? $info['images'] : json_decode($info['images'], true);
} else {
$pics = [];
}
$pics = is_array($pics) ? $pics : [];
$rule[] = FormBuilder::frameImages('images', '轮播图', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'images', 'type' => 'many', 'maxLength' => 10]), $pics)->maxLength(10)->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false])->required();
$rule[] = FormBuilder::input("title", "标题", $info["title"] ?? '');
$rule[] = FormBuilder::input("en_title", "英文标题", $info["en_title"] ?? '');
$rule[] = FormBuilder::textarea("profile", "简介", $info["profile"] ?? '');
$rule[] = FormBuilder::textarea("en_profile", "英文简介", $info["en_profile"] ?? '');
$rule[] = FormBuilder::textarea("content", "产品详情", $info["content"] ?? '');
$rule[] = FormBuilder::textarea("en_content", "英文产品详情", $info["en_content"] ?? '');
return create_form('网站产品', $rule, $url, $id ? 'PUT' : 'POST');
}
/**
* 新增
* @date 2025/04/22
* @param array $data
* @return mixed
*/
public function crudSave(array $data)
{
return $this->dao->save($data);
}
/**
* 修改
* @date 2025/04/22
* @param int $id
* @param array $data
* @return \crmeb\basic\BaseModel
*/
public function crudUpdate(int $id, array $data)
{
return $this->dao->update($id, $data);
}
}

View File

@ -0,0 +1,112 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/libs/request';
/**
* 获取列表数据
* @param params
* @return {*}
*/
export function getWebsiteProductsListApi(params) {
return request({
url: 'crud/website_products',
method: 'get',
params,
});
}
/**
* 获取添加表单数据
* @return {*}
*/
export function getWebsiteProductsCreateApi() {
return request({
url: 'crud/website_products/create',
method: 'get',
});
}
/**
* 添加数据
* @param data
* @return {*}
*/
export function websiteProductsSaveApi(data) {
return request({
url: 'crud/website_products',
method: 'post',
data
});
}
/**
* 获取编辑表单数据
* @param id
* @return {*}
*/
export function getWebsiteProductsEditApi(id) {
return request({
url: `crud/website_products/${id}/edit`,
method: 'get'
});
}
/**
* 修改数据
* @param id
* @return {*}
*/
export function websiteProductsUpdateApi(id, data) {
return request({
url: `crud/website_products/${id}`,
method: 'put',
data
});
}
/**
* 修改状态
* @param id
* @return {*}
*/
export function websiteProductsStatusApi(id, data) {
return request({
url: `crud/website_products/status/${id}`,
method: 'put',
data
});
}
/**
* 删除数据
* @param id
* @return {*}
*/
export function websiteProductsDeleteApi(id) {
return request({
url: `crud/website_products/${id}`,
method: 'delete'
});
}
/**
* 获取数据
* @param id
* @return {*}
*/
export function getWebsiteProductsReadApi(id) {
return request({
url: `crud/website_products/${id}`,
method: 'get'
});
}

View File

@ -0,0 +1,112 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/libs/request';
/**
* 获取列表数据
* @param params
* @return {*}
*/
export function getWebsiteProductsMessageListApi(params) {
return request({
url: 'crud/website_products_message',
method: 'get',
params,
});
}
/**
* 获取添加表单数据
* @return {*}
*/
export function getWebsiteProductsMessageCreateApi() {
return request({
url: 'crud/website_products_message/create',
method: 'get',
});
}
/**
* 添加数据
* @param data
* @return {*}
*/
export function websiteProductsMessageSaveApi(data) {
return request({
url: 'crud/website_products_message',
method: 'post',
data
});
}
/**
* 获取编辑表单数据
* @param id
* @return {*}
*/
export function getWebsiteProductsMessageEditApi(id) {
return request({
url: `crud/website_products_message/${id}/edit`,
method: 'get'
});
}
/**
* 修改数据
* @param id
* @return {*}
*/
export function websiteProductsMessageUpdateApi(id, data) {
return request({
url: `crud/website_products_message/${id}`,
method: 'put',
data
});
}
/**
* 修改状态
* @param id
* @return {*}
*/
export function websiteProductsMessageStatusApi(id, data) {
return request({
url: `crud/website_products_message/status/${id}`,
method: 'put',
data
});
}
/**
* 删除数据
* @param id
* @return {*}
*/
export function websiteProductsMessageDeleteApi(id) {
return request({
url: `crud/website_products_message/${id}`,
method: 'delete'
});
}
/**
* 获取数据
* @param id
* @return {*}
*/
export function getWebsiteProductsMessageReadApi(id) {
return request({
url: `crud/website_products_message/${id}`,
method: 'get'
});
}

View File

@ -0,0 +1,221 @@
<template>
<div>
<el-card shadow="never" class="ivu-mt" :body-style="{padding:0}">
<div class="padding-add">
<el-form
ref="curlFrom"
:model="from"
:label-width="labelWidth"
:label-position="labelPosition"
inline
@submit.native.prevent
>
<el-form-item label="标题:" label-for="title">
<el-input
v-model="from.title"
placeholder="请输入标题"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="简介:" label-for="profile">
<el-input
v-model="from.profile"
placeholder="请输入简介"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="产品详情:" label-for="content">
<el-input
v-model="from.content"
placeholder="请输入产品详情"
class="form_content_width"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchs">查询</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never" dis-hover class="ivu-mt mt16">
<el-row type="flex">
<el-col v-bind="grid">
<el-button v-auth="['website_products-add']" type="primary" icon="md-add" @click="add">添加</el-button>
</el-col>
</el-row>
<el-table
:data="dataList"
ref="table"
class="mt25"
:loading="loading"
highlight-current-row
>
<el-table-column label="列表头图">
<template slot-scope="scope">
<div class="tabBox_img" v-viewer>
<img v-lazy="scope.row.image" />
</div>
</template>
</el-table-column>
<el-table-column label="轮播图">
<template slot-scope="scope">
<div class="tabBox_img" v-viewer>
<img v-lazy="img" v-for="img in scope.row.images_label" />
</div>
</template>
</el-table-column>
<el-table-column prop="title" label="标题">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a @click="show(scope.row)">详情</a>
<el-divider direction="vertical" />
<a @click="edit(scope.row.id)">修改</a>
<el-divider direction="vertical" />
<a @click="del(scope.row, '删除', scope.$index)">删除</a>
</template>
</el-table-column>
</el-table>
<div class="acea-row row-right page">
<pagination :total="total" @pagination="pageChange" :limit.sync="from.limit" :page.sync="from.page" />
</div>
</el-card>
<el-dialog title="查看详情" :visible.sync="dialogTableVisible" v-if='dialogTableVisible'>
<el-descriptions title="website_products">
<el-descriptions-item label="自增ID">{{info.id}}</el-descriptions-item>
<el-descriptions-item label="列表头图"><el-image :src="info.image" :preview-src-list="info.image"></el-descriptions-item>
<el-descriptions-item label="详情轮播图"><el-image v-for="item in info.images_label" :src="item" :preview-src-list="info.images_label"></el-descriptions-item>
<el-descriptions-item label="标题">{{info.title}}</el-descriptions-item>
<el-descriptions-item label="简介">{{info.profile}}</el-descriptions-item>
<el-descriptions-item label="产品详情">{{info.content}}</el-descriptions-item>
<el-descriptions-item label="添加时间">{{info.create_time}}</el-descriptions-item>
<el-descriptions-item label="修改时间">{{info.update_time}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { websiteProductsSaveApi, websiteProductsStatusApi, websiteProductsDeleteApi, websiteProductsUpdateApi, getWebsiteProductsCreateApi, getWebsiteProductsEditApi, getWebsiteProductsListApi, getWebsiteProductsReadApi} from '@/api/crud/websiteProducts';
export default {
name: 'website_products',
data() {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24,
},
loading: false,
from: {
title:'',
profile:'',
content:'',
page: 1,
limit: 15,
},
dataList: [],
total: 0,
dialogTableVisible: false,
info: {},
};
},
computed: {
...mapState('media', ['isMobile']),
labelWidth() {
return this.isMobile ? undefined : '75px';
},
labelPosition() {
return this.isMobile ? 'top' : 'left';
},
},
created() {
this.getList();
},
methods: {
show(row) {
getWebsiteProductsReadApi(row.id).then(res => {
this.dialogTableVisible = true;
this.info = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
updateStatus(row, field) {
websiteProductsStatusApi(row.id, {field: field, value: row[field]})
.then(async (res) => {
this.$message.success(res.msg);
})
.catch((res) => {
this.$message.error(res.msg);
});
},
//
add() {
this.$modalForm(getWebsiteProductsCreateApi()).then(() => this.getList());
},
//
searchs() {
this.from.page = 1;
this.getList();
},
//
getList() {
this.loading = true;
getWebsiteProductsListApi(this.from)
.then(async (res) => {
let data = res.data;
this.dataList = data.list;
this.total = data.count;
this.loading = false;
})
.catch((res) => {
this.loading = false;
this.$Message.error(res.msg);
});
},
//
pageChange(index) {
this.from.page = index;
this.getList();
},
//
edit(id) {
this.$modalForm(getWebsiteProductsEditApi(id)).then(() => this.getList());
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `crud/website_products/${row.id}`,
method: 'DELETE',
ids: '',
};
this.$modalSure(delfromData)
.then((res) => {
this.$Message.success(res.msg);
this.getList();
})
.catch((res) => {
this.$Message.error(res.msg);
});
},
},
};
</script>
<style scoped lang="stylus"></style>

View File

@ -0,0 +1,244 @@
<template>
<div>
<el-card shadow="never" class="ivu-mt" :body-style="{padding:0}">
<div class="padding-add">
<el-form
ref="curlFrom"
:model="from"
:label-width="labelWidth"
:label-position="labelPosition"
inline
@submit.native.prevent
>
<el-form-item label="留言产品:" label-for="product_id">
<el-input
v-model="from.product_id"
placeholder="请输入留言产品"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="姓名:" label-for="name">
<el-input
v-model="from.name"
placeholder="请输入姓名"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="电子邮箱:" label-for="emil">
<el-input
v-model="from.emil"
placeholder="请输入电子邮箱"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="电话:" label-for="mobile">
<el-input
v-model="from.mobile"
placeholder="请输入电话"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="公司:" label-for="company">
<el-input
v-model="from.company"
placeholder="请输入公司"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="主题:" label-for="subject">
<el-input
v-model="from.subject"
placeholder="请输入主题"
class="form_content_width"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchs">查询</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never" dis-hover class="ivu-mt mt16">
<el-row type="flex">
<el-col v-bind="grid">
<el-button v-auth="['website_products_message-add']" type="primary" icon="md-add" @click="add">添加</el-button>
</el-col>
</el-row>
<el-table
:data="dataList"
ref="table"
class="mt25"
:loading="loading"
highlight-current-row
>
<el-table-column prop="product_id" label="留言产品">
</el-table-column>
<el-table-column prop="name" label="姓名">
</el-table-column>
<el-table-column prop="emil" label="电子邮箱">
</el-table-column>
<el-table-column prop="mobile" label="电话">
</el-table-column>
<el-table-column prop="company" label="公司">
</el-table-column>
<el-table-column prop="subject" label="主题">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a @click="show(scope.row)">详情</a>
<el-divider direction="vertical" />
<a @click="edit(scope.row.id)">修改</a>
<el-divider direction="vertical" />
<a @click="del(scope.row, '删除', scope.$index)">删除</a>
</template>
</el-table-column>
</el-table>
<div class="acea-row row-right page">
<pagination :total="total" @pagination="pageChange" :limit.sync="from.limit" :page.sync="from.page" />
</div>
</el-card>
<el-dialog title="查看详情" :visible.sync="dialogTableVisible" v-if='dialogTableVisible'>
<el-descriptions title="website_products_message">
<el-descriptions-item label="自增ID">{{info.id}}</el-descriptions-item>
<el-descriptions-item label="留言产品">{{info.product_id}}</el-descriptions-item>
<el-descriptions-item label="姓名">{{info.name}}</el-descriptions-item>
<el-descriptions-item label="电子邮箱">{{info.emil}}</el-descriptions-item>
<el-descriptions-item label="电话">{{info.mobile}}</el-descriptions-item>
<el-descriptions-item label="公司">{{info.company}}</el-descriptions-item>
<el-descriptions-item label="主题">{{info.subject}}</el-descriptions-item>
<el-descriptions-item label="内容">{{info.content}}</el-descriptions-item>
<el-descriptions-item label="添加时间">{{info.create_time}}</el-descriptions-item>
<el-descriptions-item label="修改时间">{{info.update_time}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { websiteProductsMessageSaveApi, websiteProductsMessageStatusApi, websiteProductsMessageDeleteApi, websiteProductsMessageUpdateApi, getWebsiteProductsMessageCreateApi, getWebsiteProductsMessageEditApi, getWebsiteProductsMessageListApi, getWebsiteProductsMessageReadApi} from '@/api/crud/websiteProductsMessage';
export default {
name: 'website_products_message',
data() {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24,
},
loading: false,
from: {
product_id:'',
name:'',
emil:'',
mobile:'',
company:'',
subject:'',
page: 1,
limit: 15,
},
dataList: [],
total: 0,
dialogTableVisible: false,
info: {},
};
},
computed: {
...mapState('media', ['isMobile']),
labelWidth() {
return this.isMobile ? undefined : '75px';
},
labelPosition() {
return this.isMobile ? 'top' : 'left';
},
},
created() {
this.getList();
},
methods: {
show(row) {
getWebsiteProductsMessageReadApi(row.id).then(res => {
this.dialogTableVisible = true;
this.info = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
updateStatus(row, field) {
websiteProductsMessageStatusApi(row.id, {field: field, value: row[field]})
.then(async (res) => {
this.$message.success(res.msg);
})
.catch((res) => {
this.$message.error(res.msg);
});
},
//
add() {
this.$modalForm(getWebsiteProductsMessageCreateApi()).then(() => this.getList());
},
//
searchs() {
this.from.page = 1;
this.getList();
},
//
getList() {
this.loading = true;
getWebsiteProductsMessageListApi(this.from)
.then(async (res) => {
let data = res.data;
this.dataList = data.list;
this.total = data.count;
this.loading = false;
})
.catch((res) => {
this.loading = false;
this.$Message.error(res.msg);
});
},
//
pageChange(index) {
this.from.page = index;
this.getList();
},
//
edit(id) {
this.$modalForm(getWebsiteProductsMessageEditApi(id)).then(() => this.getList());
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `crud/website_products_message/${row.id}`,
method: 'DELETE',
ids: '',
};
this.$modalSure(delfromData)
.then((res) => {
this.$Message.success(res.msg);
this.getList();
})
.catch((res) => {
this.$Message.error(res.msg);
});
},
},
};
</script>
<style scoped lang="stylus"></style>

View File

@ -0,0 +1,39 @@
// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------
import LayoutMain from '@/layout';
import setting from '@/setting'
let routePre = setting.routePre
const meta = {
auth: true,
}
const pre = 'website_products_'
export default {
path: `${routePre}`,
name: 'crud_website_products',
header: '',
meta,
component: LayoutMain,
children: [
{
path: 'crud/website_products',
name: `${pre}list`,
meta: {
auth: ['website_products-crud-list-index'],
title: '网站产品管理',
},
component: () => import('@/pages/crud/websiteProducts/index'),
},
],
}

View File

@ -0,0 +1,39 @@
// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------
import LayoutMain from '@/layout';
import setting from '@/setting'
let routePre = setting.routePre
const meta = {
auth: true,
}
const pre = 'website_products_message_'
export default {
path: `${routePre}`,
name: 'crud_website_products_message',
header: '',
meta,
component: LayoutMain,
children: [
{
path: 'crud/website_products_message',
name: `${pre}list`,
meta: {
auth: ['website_products_message-crud-list-index'],
title: '产品留言板',
},
component: () => import('@/pages/crud/websiteProductsMessage/index'),
},
],
}