页面和接口调整

This commit is contained in:
焦钰锟 2025-03-19 17:40:04 +08:00
parent 453c83b73f
commit 80acb020ea
17 changed files with 904 additions and 6 deletions

View File

@ -55,12 +55,14 @@ class LeaveWord extends AuthController
*/
public function index()
{
$where = $this->request->getMore([
['name', ''],
['mobile', ''],
['content', ''],
['create_time', ''],
]);
// var_dump(1111);
return app('json')->success($this->service->getCrudListIndex($where));
}

View File

@ -0,0 +1,207 @@
<?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/03/17
*/
namespace app\adminapi\controller\crud;
use app\adminapi\controller\AuthController;
use think\facade\App;
use app\services\crud\ShareListServices;
/**
* Class ShareList
* @date 2025/03/17
* @package app\adminapi\controller\crud
*/
class ShareList extends AuthController
{
/**
* @var ShareListServices
*/
protected $service;
/**
* ShareListController constructor.
* @param App $app
* @param ShareListServices $service
*/
public function __construct(App $app, ShareListServices $service)
{
parent::__construct($app);
$this->service = $service;
}
/**
* 列表
* @date 2025/03/17
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
]);
return app('json')->success($this->service->getCrudListIndex($where));
}
/**
* 创建
* @return \think\Response
* @date 2025/03/17
*/
public function create()
{
return app('json')->success($this->service->getCrudForm());
}
/**
* 保存
* @return \think\Response
* @date 2025/03/17
*/
public function save()
{
$data = $this->request->postMore([
['name', ''],
['link', ''],
['img', ''],
['img_two', ''],
['sort', ''],
]);
validate(\app\adminapi\validate\crud\ShareListValidate::class)->check($data);
$this->service->crudSave($data);
return app('json')->success(100021);
}
/**
* 编辑获取数据
* @param $id
* @return \think\Response
* @date 2025/03/17
*/
public function edit($id)
{
return app('json')->success($this->service->getCrudForm((int)$id));
}
/**
* 修改
* @param $id
* @return \think\Response
* @date 2025/03/17
*/
public function update($id)
{
if (!$id) {
return app('json')->fail(100100);
}
$data = $this->request->postMore([
['name', ''],
['link', ''],
['img', ''],
['img_two', ''],
['sort', ''],
]);
validate(\app\adminapi\validate\crud\ShareListValidate::class)->check($data);
$this->service->crudUpdate((int)$id, $data);
return app('json')->success(100001);
}
/**
* 修改状态
* @param $id
* @return \think\Response
* @date 2025/03/17
*/
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/03/17
*/
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/03/17
*/
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,23 @@
<?php
use think\facade\Route;
Route::get('crud/share_list', 'crud.ShareList/index')->option(['real_name' => '分享列表列表接口']);
Route::get('crud/share_list/create', 'crud.ShareList/create')->option(['real_name' => '分享列表获取创建表单接口']);
Route::post('crud/share_list', 'crud.ShareList/save')->option(['real_name' => '分享列表保存接口']);
Route::get('crud/share_list/:id/edit', 'crud.ShareList/edit')->option(['real_name' => '分享列表获取修改表单接口']);
Route::put('crud/share_list/:id', 'crud.ShareList/update')->option(['real_name' => '分享列表修改接口']);
Route::put('crud/share_list/status/:id', 'crud.ShareList/status')->option(['real_name' => '分享列表修改状态接口']);
Route::delete('crud/share_list/:id', 'crud.ShareList/delete')->option(['real_name' => '分享列表删除接口']);
Route::get('crud/share_list/:id', 'crud.ShareList/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/03/17 16:22:48
*/
namespace app\adminapi\validate\crud;
use think\Validate;
/**
* Class CrudValidate
* @date 2025/03/17
* @package app\adminapi\validate\crud
*/
class ShareListValidate extends Validate
{
/**
* @var array
*/
protected $rule = [
];
/**
* @var array
*/
protected $message = [
];
/**
* @var array
*/
protected $scene = [
];
}

View File

@ -19,6 +19,7 @@
namespace app\api\controller\v1\publics;
use app\services\crud\ShareListServices;
use think\facade\App;
use app\services\crud\ProcessServices;
@ -57,6 +58,13 @@ class ProcessController
return app('json')->success($this->service->getCrudListIndex($where));
}
public function share_list(ShareListServices $service)
{
$where = [];
return app('json')->success($service->getCrudListIndex($where));
}
}

View File

@ -75,6 +75,7 @@ Route::group(function () {
Route::group(function () {
//公司历程
Route::get('process/list', 'v1.publics.ProcessController/lst')->name('processList')->option(['real_name' => '公司历程列表']);//文章列表
Route::get('share_list', 'v1.publics.ProcessController/share_list')->name('shareList')->option(['real_name' => '公司分享列表']);//文章列表
})->option(['parent' => 'activity_nologin', 'cate_name' => '公司历程']);

View File

@ -0,0 +1,59 @@
<?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/03/17 16:22:48
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\ShareList;
/**
* Class ShareListDao
* @date 2025/03/17
* @package app\dao\crud
*/
class ShareListDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2025/03/17
*/
protected function setModel(): string
{
return ShareList::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);
});
}
}

View File

@ -30,6 +30,7 @@ use crmeb\basic\BaseModel;
class LeaveWord extends BaseModel
{
/**
* 表名
* @var string
@ -41,5 +42,27 @@ class LeaveWord extends BaseModel
* @var string
*/
protected $pk = 'id';
protected $autoWriteTimestamp = 'int';
protected $createTime = 'create_time';
protected function setCreateTimeAttr()
{
return time();
}
/**
* 添加时间获取器
* @param $value
* @return false|string
*/
public function getCreateTimeAttr($value)
{
if (!empty($value)) {
return date('Y-m-d H:i:s', (int)$value);
}
return '';
}
}

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/03/17 16:22:48
*/
namespace app\model\crud;
use crmeb\basic\BaseModel;
/**
* Class ShareList
* @date 2025/03/17
* @package app\model\crud
*/
class ShareList extends BaseModel
{
/**
* 表名
* @var string
*/
protected $name = 'share_list';
/**
* 主键
* @var string
*/
protected $pk = 'id';
}

View File

@ -51,7 +51,7 @@ class LeaveWordServices extends BaseServices
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'name,mobile,content,create_time,id', 'id desc', []);
// var_dump(2222);
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}

View File

@ -0,0 +1,111 @@
<?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/03/17 16:22:48
*/
namespace app\services\crud;
use app\services\BaseServices;
use think\exception\ValidateException;
use app\dao\crud\ShareListDao;
use crmeb\services\FormBuilder;
/**
* Class CrudService
* @date 2025/03/17
* @package app\services\crud
*/
class ShareListServices extends BaseServices
{
/**
* ShareListServices constructor.
* @param ShareListDao $dao
*/
public function __construct(ShareListDao $dao)
{
$this->dao = $dao;
}
/**
* 主页数据接口
* @param array $where
* @return array
* @date 2025/03/17
*/
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->searchCrudModel($where, 'name,link,img,img_two,sort,id', 'id desc', []);
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}
/**
* 编辑和获取表单
* @date 2025/03/17
* @param int $id
* @return array
*/
public function getCrudForm(int $id = 0)
{
$url = '/crud/share_list';
$info = [];
if ($id) {
$info = $this->dao->get($id);
if (!$info) {
throw new ValidateException(100026);
}
$url .= '/' . $id;
}
$rule = [];
$rule[] = FormBuilder::input("name", "名称", $info["name"] ?? '');
$rule[] = FormBuilder::input("link", "分享链接", $info["link"] ?? '');
$rule[] = FormBuilder::frameImage('img', '图标', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'img']), $info['img'] ?? '')->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false]);
$rule[] = FormBuilder::frameImage('img_two', '蓝色图标', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'img_two']), $info['img_two'] ?? '')->icon('el-icon-picture-outline')->width('950px')->height('560px')->Props(['footer' => false]);
$rule[] = FormBuilder::number("sort", "排序", $info["sort"] ?? '');
return create_form('分享列表', $rule, $url, $id ? 'PUT' : 'POST');
}
/**
* 新增
* @date 2025/03/17
* @param array $data
* @return mixed
*/
public function crudSave(array $data)
{
return $this->dao->save($data);
}
/**
* 修改
* @date 2025/03/17
* @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

@ -1,3 +1,3 @@
# navigete-website-webhook
纳威格特官网前端打包h5(webhook)
纳威格特官网前端打包h5(webhook)22222

View File

@ -1,2 +1,24 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>加载中</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.f0650e31.js></script><script src=/static/js/index.12480fc8.js></script></body></html>
<!DOCTYPE html>
<html lang=zh-CN>
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<title>加载中</title>
<script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<link rel=stylesheet href=/static/index.97465e7b.css>
</head>
<body>
<noscript>
<strong>Please enable JavaScript to continue.
</strong>
</noscript>
<h1>1111111</h1>
<div id=app>
</div>
<script src=/static/js/chunk-vendors.f0650e31.js></script>
<script src=/static/js/index.12480fc8.js></script>f
</body>
</html>

View File

@ -25,8 +25,19 @@ Route::miss(function () {
return view(app()->getRootPath() . 'public' . DS . 'index.html');
default:
if (!request()->isMobile()) {
if (is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('mdType')) {
return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
// if (is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('mdType')) {
// return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
// } else {
// if (request()->get('type')) {
// return view(app()->getRootPath() . 'public' . DS . 'index.html');
// } else {
// return view(app()->getRootPath() . 'public' . DS . 'mobile.html', ['siteName' => sys_config('site_name'), 'siteUrl' => sys_config('site_url') . '/pages/index/index']);
// }
// }
if (is_dir(app()->getRootPath() . 'public' . DS . 'web') && !request()->get('mdType')) {
return view(app()->getRootPath() . 'public' . DS . 'web' . DS . 'index.html');
} else {
if (request()->get('type')) {
return view(app()->getRootPath() . 'public' . DS . 'index.html');
@ -34,6 +45,8 @@ Route::miss(function () {
return view(app()->getRootPath() . 'public' . DS . 'mobile.html', ['siteName' => sys_config('site_name'), 'siteUrl' => sys_config('site_url') . '/pages/index/index']);
}
}
} else {
return view(app()->getRootPath() . 'public' . DS . 'index.html');
}

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 getShareListListApi(params) {
return request({
url: 'crud/share_list',
method: 'get',
params,
});
}
/**
* 获取添加表单数据
* @return {*}
*/
export function getShareListCreateApi() {
return request({
url: 'crud/share_list/create',
method: 'get',
});
}
/**
* 添加数据
* @param data
* @return {*}
*/
export function shareListSaveApi(data) {
return request({
url: 'crud/share_list',
method: 'post',
data
});
}
/**
* 获取编辑表单数据
* @param id
* @return {*}
*/
export function getShareListEditApi(id) {
return request({
url: `crud/share_list/${id}/edit`,
method: 'get'
});
}
/**
* 修改数据
* @param id
* @return {*}
*/
export function shareListUpdateApi(id, data) {
return request({
url: `crud/share_list/${id}`,
method: 'put',
data
});
}
/**
* 修改状态
* @param id
* @return {*}
*/
export function shareListStatusApi(id, data) {
return request({
url: `crud/share_list/status/${id}`,
method: 'put',
data
});
}
/**
* 删除数据
* @param id
* @return {*}
*/
export function shareListDeleteApi(id) {
return request({
url: `crud/share_list/${id}`,
method: 'delete'
});
}
/**
* 获取数据
* @param id
* @return {*}
*/
export function getShareListReadApi(id) {
return request({
url: `crud/share_list/${id}`,
method: 'get'
});
}

View File

@ -0,0 +1,180 @@
<template>
<div>
<el-card shadow="never" dis-hover class="ivu-mt ">
<el-row type="flex">
<el-col v-bind="grid">
<el-button v-auth="['share_list-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="name" label="名称">
</el-table-column>
<el-table-column prop="link" label="分享链接">
</el-table-column>
<el-table-column label="图标">
<template slot-scope="scope">
<div class="tabBox_img" v-viewer>
<img v-lazy="scope.row.img" />
</div>
</template>
</el-table-column>
<el-table-column label="蓝色图标">
<template slot-scope="scope">
<div class="tabBox_img" v-viewer>
<img v-lazy="scope.row.img_two" />
</div>
</template>
</el-table-column>
<el-table-column prop="sort" 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="share_list">
<el-descriptions-item label="自增ID">{{info.id}}</el-descriptions-item>
<el-descriptions-item label="名称">{{info.name}}</el-descriptions-item>
<el-descriptions-item label="分享链接">{{info.link}}</el-descriptions-item>
<el-descriptions-item label="图标"><el-image :src="info.img" :preview-src-list="info.img"></el-descriptions-item>
<el-descriptions-item label="蓝色图标"><el-image :src="info.img_two" :preview-src-list="info.img_two"></el-descriptions-item>
<el-descriptions-item label="排序">{{info.sort}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { shareListSaveApi, shareListStatusApi, shareListDeleteApi, shareListUpdateApi, getShareListCreateApi, getShareListEditApi, getShareListListApi, getShareListReadApi} from '@/api/crud/shareList';
export default {
name: 'share_list',
data() {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24,
},
loading: false,
from: {
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) {
getShareListReadApi(row.id).then(res => {
this.dialogTableVisible = true;
this.info = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
updateStatus(row, field) {
shareListStatusApi(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(getShareListCreateApi()).then(() => this.getList());
},
//
searchs() {
this.from.page = 1;
this.getList();
},
//
getList() {
this.loading = true;
getShareListListApi(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(getShareListEditApi(id)).then(() => this.getList());
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `crud/share_list/${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 = 'share_list_'
export default {
path: `${routePre}`,
name: 'crud_share_list',
header: '',
meta,
component: LayoutMain,
children: [
{
path: 'crud/share_list',
name: `${pre}list`,
meta: {
auth: ['share_list-crud-list-index'],
title: '分享列表',
},
component: () => import('@/pages/crud/shareList/index'),
},
],
}