新增:md说明文档
This commit is contained in:
@@ -4,7 +4,3 @@ VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
|||||||
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||||
|
|
||||||
VITE_API_URL=http://127.0.0.1:9099/api
|
VITE_API_URL=http://127.0.0.1:9099/api
|
||||||
#VITE_SERVER_URL=http://127.0.0.1:9091/api
|
|
||||||
#VITE_SOCKET_URL=ws://localhost:9191
|
|
||||||
#VITE_API_URL=https://server.gxwebsoft.com/api
|
|
||||||
#VITE_API_URL=http://103.233.255.195:9300/api
|
|
||||||
|
|||||||
254
README.md
Normal file
254
README.md
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
<h1 style="text-align: center">websoft-uniapp 网宿软件uniapp端</h1>
|
||||||
|
|
||||||
|
#### 项目简介
|
||||||
|
websoft基于Spring、SpringBoot、SpringMVC、SpringSecurity、jjwt、MyBatis、Druid等搭建,前后端分离模式,适用于快递开发和打包为微信小程序、H5、安卓apk、苹果ios、抖音小程序、支付宝小程序等应用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 官网体验地址(里面有演示地址与文档)
|
||||||
|
| 官网文档地址 | https://www.gxwebsoft.com |
|
||||||
|
|---|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| 管理后台演示地址: | http://10193.admin.gxwebsoft.com |
|
||||||
|
| 关注公众号点体验小程序与H5 |  |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 核心依赖
|
||||||
|
|
||||||
|
| 依赖 | 版本 |
|
||||||
|
|-----------------|--------|
|
||||||
|
| Spring Boot | 2.7.x |
|
||||||
|
| weixin-java | 4.4.0 |
|
||||||
|
| Spring Security | 2.7.10 |
|
||||||
|
| Mybatis Plus | 3.5.2 |
|
||||||
|
| hutool | 5.8.16 |
|
||||||
|
| swagger | 3.0.0 |
|
||||||
|
|
||||||
|
# 本地安装
|
||||||
|
### 基本环境(必备)
|
||||||
|
- 1、JDK:8+
|
||||||
|
- 2、Redis 3.0+
|
||||||
|
- 3、Maven 3.0+
|
||||||
|
- 4、MYSQL 5.7+
|
||||||
|
- 5、Node v8+
|
||||||
|
### 开发工具
|
||||||
|
Idea、webstorm、vscode
|
||||||
|
|
||||||
|
### 后台系统工程(JAVA端)
|
||||||
|
|
||||||
|
1、请确保redis已经安装启动
|
||||||
|
|
||||||
|
2、下载代码
|
||||||
|
```
|
||||||
|
git clone https://gitee.com/gxwebsoft/websoft-uniapp.git
|
||||||
|
```
|
||||||
|
3、使用HBuiderX导入项目:
|
||||||
|
|
||||||
|
4、安装依赖:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install luch-request -S
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 后台前端工程(VUE端)
|
||||||
|
1、请确保本地已经安装node,建议node8或者node10
|
||||||
|
|
||||||
|
2、下载代码
|
||||||
|
```
|
||||||
|
git clone https://gitee.com/gxwebsoft/websoft-vue.git
|
||||||
|
```
|
||||||
|
3、cnpm install或者yarn install,当前所有命令必须当前工程目录下进行:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
4、安装依赖失败
|
||||||
|
```
|
||||||
|
yarn
|
||||||
|
```
|
||||||
|
5、在控制台输入命令:npm run dev,控制台打印出如下画面,恭喜表示本项目启动成功拉。
|
||||||
|
|
||||||
|
5、打开浏览器输入地址如图:
|
||||||
|
|
||||||
|
默认超管账户密码:admin/123456
|
||||||
|
|
||||||
|
|
||||||
|
# nginx线上部署
|
||||||
|
|
||||||
|
### 后台系统(Java端)
|
||||||
|
|
||||||
|
1、mvn install 或者直接idea打成jar包
|
||||||
|
|
||||||
|
2、配置nginx 反向代理如下:
|
||||||
|
```
|
||||||
|
server{
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name api.gxwebsoft.com;
|
||||||
|
#listen [::]:81 default_server ipv6only=on;
|
||||||
|
#ssl on;
|
||||||
|
ssl_certificate httpssl/gxwebsoft.cn.pem;
|
||||||
|
ssl_certificate_key httpssl/api.gxwebsoft.cn.key;
|
||||||
|
ssl_session_timeout 5m;
|
||||||
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
#include enable-php.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:9090;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
access_log /home/wwwlogs/websoftapi.log;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
我配置的了ssl证书,如果不需要证书配置如下即可:
|
||||||
|
|
||||||
|
```
|
||||||
|
server{
|
||||||
|
listen 80;
|
||||||
|
server_name api.gxwebsoft.com;
|
||||||
|
#listen [::]:81 default_server ipv6only=on;
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
#include enable-php.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
access_log /home/wwwlogs/websoftapi.log;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 后台前端工程(VUE端)
|
||||||
|
1、输入命令:npm run build:prod 编译打包
|
||||||
|
|
||||||
|
2、把打包后的dist目录代码上传到服务器
|
||||||
|
|
||||||
|
3、配置nginx如下:
|
||||||
|
```
|
||||||
|
server
|
||||||
|
{
|
||||||
|
listen 443 ssl;
|
||||||
|
#listen [::]:81 default_server ipv6only=on;
|
||||||
|
server_name www.gxwesboft.com;
|
||||||
|
#ssl on;
|
||||||
|
ssl_certificate httpssl/www.gxwebsoft.com.pem;
|
||||||
|
ssl_certificate_key httpssl/www.gxwebsoft.com.key;
|
||||||
|
ssl_session_timeout 5m;
|
||||||
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
index index.html;
|
||||||
|
root /home/wwwroot/system/websoft;
|
||||||
|
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ @router;
|
||||||
|
index index.html;
|
||||||
|
· }
|
||||||
|
location @router {
|
||||||
|
rewrite ^.*$ /index.html last;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
location ~* \.(eot|ttf|woff)$ {
|
||||||
|
# add_header Access-Control-Allow-Origin *;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
|
||||||
|
{
|
||||||
|
expires 30d;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ .*\.(js|css)?$
|
||||||
|
{
|
||||||
|
expires 12h;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
access_log /home/wwwlogs/websoftapi.log;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
不需要证书如上面Java端配置一样去掉相关证书配置 改监听端口80即可
|
||||||
|
|
||||||
|
|
||||||
|
### 功能模块
|
||||||
|
|
||||||
|
* 一:商品模块:商品添加、规格设置,商品上下架等
|
||||||
|
* 二:订单模块:下单、购物车、支付,发货、收货、评价、退款等
|
||||||
|
* 三:营销模块:积分、优惠券、分销、砍价、拼团、秒杀、多门店等
|
||||||
|
* 四:微信模块:自定义菜单、自动回复、微信授权、图文管理、模板消息推送
|
||||||
|
* 五:配置模块:各种配置
|
||||||
|
* 六:用户模块:登陆、注册、会员卡、充值等
|
||||||
|
* 七:其他模块:场地预定模块、办公协同模块等
|
||||||
|
|
||||||
|
|
||||||
|
#### 项目结构
|
||||||
|
项目采用分模块开发方式
|
||||||
|
- gxwebsoft-common 公共模块
|
||||||
|
- gxwebsoft-cms 预定模块
|
||||||
|
- gxwebsoft-shop 商城模块
|
||||||
|
- gxwebsoft-booking 预定模块
|
||||||
|
- gxwebsoft-oa oa模块
|
||||||
|
- gxwebsoft-weixin 微信相关模块
|
||||||
|
- gxwebsoft-generator 代码生成模块
|
||||||
|
|
||||||
|
|
||||||
|
### 技术选型
|
||||||
|
* 1 后端使用技术
|
||||||
|
* 1.1 SpringBoot2
|
||||||
|
* 1.2 mybatis、MyBatis-Plus
|
||||||
|
* 1.3 SpringSecurity
|
||||||
|
* 1.5 Druid
|
||||||
|
* 1.6 Slf4j
|
||||||
|
* 1.7 Fastjson
|
||||||
|
* 1.8 JWT
|
||||||
|
* 1.9 Redis
|
||||||
|
* 1.10 eleadmin
|
||||||
|
* 1.11 Mysql
|
||||||
|
* 1.12 swagger
|
||||||
|
* 1.13 WxJava
|
||||||
|
* 1.14 Lombok
|
||||||
|
* 1.15 Hutool
|
||||||
|
|
||||||
|
* 前端使用技术
|
||||||
|
* 2.1 Vue 全家桶
|
||||||
|
* 2.2 Antdv
|
||||||
|
* 2.3 uniapp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 反馈交流
|
||||||
|
- 喜欢这个系统的小伙伴留下你的小星星啦,star,star哦!
|
||||||
|
|
||||||
|
#### 特别鸣谢
|
||||||
|
- mybaitsplus:https://github.com/baomidou/mybatis-plus
|
||||||
|
- hutool:https://github.com/looly/hutool
|
||||||
|
- eleadmin:https://eleadmin.com/
|
||||||
|
- wxjava:https://github.com/Wechat-Group/WxJava
|
||||||
|
- vue:https://github.com/vuejs/vue
|
||||||
|
- antdv:https://3x.antdv.com/components/overview-cn
|
||||||
106
src/api/booking/course/index.ts
Normal file
106
src/api/booking/course/index.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { Course, CourseParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询课程管理
|
||||||
|
*/
|
||||||
|
export async function pageCourse(params: CourseParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<Course>>>(
|
||||||
|
MODULES_API_URL + '/booking/course/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程管理列表
|
||||||
|
*/
|
||||||
|
export async function listCourse(params?: CourseParam) {
|
||||||
|
const res = await request.get<ApiResult<Course[]>>(
|
||||||
|
MODULES_API_URL + '/booking/course',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加课程管理
|
||||||
|
*/
|
||||||
|
export async function addCourse(data: Course) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程管理
|
||||||
|
*/
|
||||||
|
export async function updateCourse(data: Course) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程管理
|
||||||
|
*/
|
||||||
|
export async function removeCourse(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程管理
|
||||||
|
*/
|
||||||
|
export async function removeBatchCourse(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询课程管理
|
||||||
|
*/
|
||||||
|
export async function getCourse(id: number) {
|
||||||
|
const res = await request.get<ApiResult<Course>>(
|
||||||
|
MODULES_API_URL + '/booking/course/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
55
src/api/booking/course/model/index.ts
Normal file
55
src/api/booking/course/model/index.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程管理
|
||||||
|
*/
|
||||||
|
export interface Course {
|
||||||
|
// ID
|
||||||
|
lessonId?: number;
|
||||||
|
// 课程名称
|
||||||
|
lessonName?: string;
|
||||||
|
// 封面图
|
||||||
|
image?: string;
|
||||||
|
// 分类ID
|
||||||
|
categoryId?: number;
|
||||||
|
// 课程价格
|
||||||
|
price?: string;
|
||||||
|
// 老师ID
|
||||||
|
teacherId?: number;
|
||||||
|
// 上课时间
|
||||||
|
startTime?: string;
|
||||||
|
// 课时
|
||||||
|
classPeriod?: number;
|
||||||
|
// 报名人数上限
|
||||||
|
maxNumber?: number;
|
||||||
|
// 上课地点
|
||||||
|
address?: string;
|
||||||
|
// 详细介绍
|
||||||
|
content?: string;
|
||||||
|
// 课程相册
|
||||||
|
files?: string;
|
||||||
|
// 年龄限制
|
||||||
|
ageLimit?: string;
|
||||||
|
// 报名时间
|
||||||
|
bmTime?: string;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 商户ID
|
||||||
|
merchantId?: number;
|
||||||
|
// 状态
|
||||||
|
status?: number;
|
||||||
|
// 排序号
|
||||||
|
sortNumber?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程管理搜索条件
|
||||||
|
*/
|
||||||
|
export interface CourseParam extends PageParam {
|
||||||
|
lessonId?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
106
src/api/booking/courseCategory/index.ts
Normal file
106
src/api/booking/courseCategory/index.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { CourseCategory, CourseCategoryParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询课程分类
|
||||||
|
*/
|
||||||
|
export async function pageCourseCategory(params: CourseCategoryParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<CourseCategory>>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程分类列表
|
||||||
|
*/
|
||||||
|
export async function listCourseCategory(params?: CourseCategoryParam) {
|
||||||
|
const res = await request.get<ApiResult<CourseCategory[]>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加课程分类
|
||||||
|
*/
|
||||||
|
export async function addCourseCategory(data: CourseCategory) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程分类
|
||||||
|
*/
|
||||||
|
export async function updateCourseCategory(data: CourseCategory) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程分类
|
||||||
|
*/
|
||||||
|
export async function removeCourseCategory(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程分类
|
||||||
|
*/
|
||||||
|
export async function removeBatchCourseCategory(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询课程分类
|
||||||
|
*/
|
||||||
|
export async function getCourseCategory(id: number) {
|
||||||
|
const res = await request.get<ApiResult<CourseCategory>>(
|
||||||
|
MODULES_API_URL + '/booking/course-category/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
41
src/api/booking/courseCategory/model/index.ts
Normal file
41
src/api/booking/courseCategory/model/index.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程分类
|
||||||
|
*/
|
||||||
|
export interface CourseCategory {
|
||||||
|
// 商品分类ID
|
||||||
|
id?: number;
|
||||||
|
// 分类名称
|
||||||
|
name?: string;
|
||||||
|
// 分类标识
|
||||||
|
code?: string;
|
||||||
|
// 分类图片
|
||||||
|
image?: string;
|
||||||
|
// 上级分类ID
|
||||||
|
parentId?: number;
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 是否推荐
|
||||||
|
recommend?: number;
|
||||||
|
// 状态, 0正常, 1禁用
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程分类搜索条件
|
||||||
|
*/
|
||||||
|
export interface CourseCategoryParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
304
src/views/booking/course/components/courseEdit.vue
Normal file
304
src/views/booking/course/components/courseEdit.vue
Normal file
@@ -0,0 +1,304 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑课程管理' : '添加课程管理'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="课程名称" name="lessonName">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入课程名称"
|
||||||
|
v-model:value="form.lessonName"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
label="封面图"
|
||||||
|
name="image">
|
||||||
|
<SelectFile
|
||||||
|
:placeholder="`请选择图片`"
|
||||||
|
:limit="1"
|
||||||
|
:data="images"
|
||||||
|
@done="chooseImage"
|
||||||
|
@del="onDeleteItem"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="分类ID" name="categoryId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入分类ID"
|
||||||
|
v-model:value="form.categoryId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="课程价格" name="price">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入课程价格"
|
||||||
|
v-model:value="form.price"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="老师ID" name="teacherId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入老师ID"
|
||||||
|
v-model:value="form.teacherId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="上课时间" name="startTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入上课时间"
|
||||||
|
v-model:value="form.startTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="课时" name="classPeriod">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入课时"
|
||||||
|
v-model:value="form.classPeriod"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="报名人数上限" name="maxNumber">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入报名人数上限"
|
||||||
|
v-model:value="form.maxNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="上课地点" name="address">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入上课地点"
|
||||||
|
v-model:value="form.address"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="详细介绍" name="content">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入详细介绍"
|
||||||
|
v-model:value="form.content"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="课程相册" name="files">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入课程相册"
|
||||||
|
v-model:value="form.files"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="年龄限制" name="ageLimit">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入年龄限制"
|
||||||
|
v-model:value="form.ageLimit"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="报名时间" name="bmTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入报名时间"
|
||||||
|
v-model:value="form.bmTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="商户ID" name="merchantId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入商户ID"
|
||||||
|
v-model:value="form.merchantId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排序号" name="sortNumber">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
v-model:value="form.sortNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addCourse, updateCourse } from '@/api/booking/course';
|
||||||
|
import { Course } from '@/api/booking/course/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: Course | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<Course>({
|
||||||
|
lessonId: undefined,
|
||||||
|
lessonName: undefined,
|
||||||
|
image: undefined,
|
||||||
|
categoryId: undefined,
|
||||||
|
price: undefined,
|
||||||
|
teacherId: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
classPeriod: undefined,
|
||||||
|
maxNumber: undefined,
|
||||||
|
address: undefined,
|
||||||
|
content: undefined,
|
||||||
|
files: undefined,
|
||||||
|
ageLimit: undefined,
|
||||||
|
bmTime: undefined,
|
||||||
|
comments: undefined,
|
||||||
|
merchantId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
sortNumber: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
courseId: undefined,
|
||||||
|
courseName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
courseName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写课程管理名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateCourse : addCourse;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
42
src/views/booking/course/components/search.vue
Normal file
42
src/views/booking/course/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
317
src/views/booking/course/index.vue
Normal file
317
src/views/booking/course/index.vue
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="courseId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<CourseEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import CourseEdit from './components/courseEdit.vue';
|
||||||
|
import { pageCourse, removeCourse, removeBatchCourse } from '@/api/booking/course';
|
||||||
|
import type { Course, CourseParam } from '@/api/booking/course/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<Course[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<Course | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageCourse({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'lessonId',
|
||||||
|
key: 'lessonId',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '课程名称',
|
||||||
|
dataIndex: 'lessonName',
|
||||||
|
key: 'lessonName',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '封面图',
|
||||||
|
dataIndex: 'image',
|
||||||
|
key: 'image',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类ID',
|
||||||
|
dataIndex: 'categoryId',
|
||||||
|
key: 'categoryId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '课程价格',
|
||||||
|
dataIndex: 'price',
|
||||||
|
key: 'price',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '老师ID',
|
||||||
|
dataIndex: 'teacherId',
|
||||||
|
key: 'teacherId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '上课时间',
|
||||||
|
dataIndex: 'startTime',
|
||||||
|
key: 'startTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '课时',
|
||||||
|
dataIndex: 'classPeriod',
|
||||||
|
key: 'classPeriod',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '报名人数上限',
|
||||||
|
dataIndex: 'maxNumber',
|
||||||
|
key: 'maxNumber',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '上课地点',
|
||||||
|
dataIndex: 'address',
|
||||||
|
key: 'address',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '详细介绍',
|
||||||
|
dataIndex: 'content',
|
||||||
|
key: 'content',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '课程相册',
|
||||||
|
dataIndex: 'files',
|
||||||
|
key: 'files',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '年龄限制',
|
||||||
|
dataIndex: 'ageLimit',
|
||||||
|
key: 'ageLimit',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '报名时间',
|
||||||
|
dataIndex: 'bmTime',
|
||||||
|
key: 'bmTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
dataIndex: 'comments',
|
||||||
|
key: 'comments',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '商户ID',
|
||||||
|
dataIndex: 'merchantId',
|
||||||
|
key: 'merchantId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '排序号',
|
||||||
|
dataIndex: 'sortNumber',
|
||||||
|
key: 'sortNumber',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: CourseParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: Course) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: Course) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeCourse(row.courseId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchCourse(selection.value.map((d) => d.courseId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: Course) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'Course'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑课程分类' : '添加课程分类'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="分类名称" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
v-model:value="form.name"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="分类标识" name="code">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入分类标识"
|
||||||
|
v-model:value="form.code"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
label="分类图片"
|
||||||
|
name="image">
|
||||||
|
<SelectFile
|
||||||
|
:placeholder="`请选择图片`"
|
||||||
|
:limit="1"
|
||||||
|
:data="images"
|
||||||
|
@done="chooseImage"
|
||||||
|
@del="onDeleteItem"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="上级分类ID" name="parentId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入上级分类ID"
|
||||||
|
v-model:value="form.parentId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
v-model:value="form.sortNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否推荐" name="recommend">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否推荐"
|
||||||
|
v-model:value="form.recommend"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态, 0正常, 1禁用" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否删除, 0否, 1是"
|
||||||
|
v-model:value="form.deleted"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addCourseCategory, updateCourseCategory } from '@/api/booking/courseCategory';
|
||||||
|
import { CourseCategory } from '@/api/booking/courseCategory/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: CourseCategory | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<CourseCategory>({
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
code: undefined,
|
||||||
|
image: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
sortNumber: undefined,
|
||||||
|
comments: undefined,
|
||||||
|
recommend: undefined,
|
||||||
|
status: undefined,
|
||||||
|
deleted: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
courseCategoryId: undefined,
|
||||||
|
courseCategoryName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
courseCategoryName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写课程分类名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateCourseCategory : addCourseCategory;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
42
src/views/booking/courseCategory/components/search.vue
Normal file
42
src/views/booking/courseCategory/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
275
src/views/booking/courseCategory/index.vue
Normal file
275
src/views/booking/courseCategory/index.vue
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="courseCategoryId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<CourseCategoryEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import CourseCategoryEdit from './components/courseCategoryEdit.vue';
|
||||||
|
import { pageCourseCategory, removeCourseCategory, removeBatchCourseCategory } from '@/api/booking/courseCategory';
|
||||||
|
import type { CourseCategory, CourseCategoryParam } from '@/api/booking/courseCategory/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<CourseCategory[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<CourseCategory | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageCourseCategory({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '商品分类ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类标识',
|
||||||
|
dataIndex: 'code',
|
||||||
|
key: 'code',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类图片',
|
||||||
|
dataIndex: 'image',
|
||||||
|
key: 'image',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '上级分类ID',
|
||||||
|
dataIndex: 'parentId',
|
||||||
|
key: 'parentId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '排序(数字越小越靠前)',
|
||||||
|
dataIndex: 'sortNumber',
|
||||||
|
key: 'sortNumber',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
dataIndex: 'comments',
|
||||||
|
key: 'comments',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否推荐',
|
||||||
|
dataIndex: 'recommend',
|
||||||
|
key: 'recommend',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态, 0正常, 1禁用',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否删除, 0否, 1是',
|
||||||
|
dataIndex: 'deleted',
|
||||||
|
key: 'deleted',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: CourseCategoryParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: CourseCategory) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: CourseCategory) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeCourseCategory(row.courseCategoryId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchCourseCategory(selection.value.map((d) => d.courseCategoryId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: CourseCategory) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'CourseCategory'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -7,17 +7,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>添加</span>
|
<span>添加</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-select ref="select" v-model:value="menuType" style="width: 120px" @change="onChange">
|
|
||||||
<a-select-option value="图片广告">图片广告</a-select-option>
|
|
||||||
<a-select-option value="幻灯片">幻灯片</a-select-option>
|
|
||||||
<a-select-option value="视频广告">视频广告</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
<!-- <a-button-->
|
|
||||||
<!-- type="primary"-->
|
|
||||||
<!-- style="background-color: var(--orange-6); border-color: var(--orange-5)"-->
|
|
||||||
<!-- @click="openPeriod"-->
|
|
||||||
<!-- >导航展示方式</a-button-->
|
|
||||||
<!-- >-->
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
146
src/views/help/deploy/index.vue
Normal file
146
src/views/help/deploy/index.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
|
<!-- <a-result title="内容整理中">-->
|
||||||
|
<!-- <template #icon>-->
|
||||||
|
<!-- <SmileTwoTone />-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <div>内容整理中...</div>-->
|
||||||
|
<!-- </a-result>-->
|
||||||
|
<a-collapse v-model:activeKey="activeKey">
|
||||||
|
<a-collapse-panel key="1" header="Java端部署">
|
||||||
|
<a-typography-title :level="5"
|
||||||
|
>1.请确保redis已经安装启动</a-typography-title
|
||||||
|
>
|
||||||
|
<a-typography-title :level="5">2.下载源代码</a-typography-title>
|
||||||
|
<a-typography-paragraph code copyable
|
||||||
|
>git clone
|
||||||
|
http://git.gxwebsoft.com/gxwebsoft/websoft-java.git</a-typography-paragraph
|
||||||
|
>
|
||||||
|
<a-typography-title :level="5"
|
||||||
|
>3.idea导入项目加载依赖</a-typography-title
|
||||||
|
>
|
||||||
|
<a-typography-title :level="5"
|
||||||
|
>4.导入数据库,配置开发环境数据库信息及其redis信息,文件路径如下:</a-typography-title
|
||||||
|
>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/4c37d7398318464d964fe24a7e7a792f.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-title :level="5">5.打包</a-typography-title>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/84e5db30b82944ab92b078a352fcb442.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-title :level="5">6.上传jar包并部署</a-typography-title>
|
||||||
|
<p>这里使用宝塔面板部署,也可以参数网上的其他方式部署</p>
|
||||||
|
<p
|
||||||
|
>部署成功后接口地址:<a-typography-text code copyable
|
||||||
|
>https://modules.gxwebsoft.com/api</a-typography-text
|
||||||
|
></p
|
||||||
|
>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/62d50f13b7e14c238f5447973f5bf508.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
</a-collapse-panel>
|
||||||
|
<a-collapse-panel key="2" header="Vue端部分">
|
||||||
|
<a-typography-title :level="5">1.下载源代码</a-typography-title>
|
||||||
|
<a-typography-paragraph code copyable
|
||||||
|
>git clone
|
||||||
|
http://git.gxwebsoft.com/gxwebsoft/websoft-vue.git</a-typography-paragraph
|
||||||
|
>
|
||||||
|
<a-typography-title :level="5">2.配置接口信息</a-typography-title>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
开发环境:根目录下的.env.development文件
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
生产环境:根目录下的.env.production文件
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/eacebc1d403e49e6bca3ce27e910ef17.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-title :level="5">3.编译打包</a-typography-title>
|
||||||
|
<a-typography-text code copyable>vite build</a-typography-text>
|
||||||
|
<a-typography-title :level="5"
|
||||||
|
>4.创建站点并上传文件包解压</a-typography-title
|
||||||
|
>
|
||||||
|
<a-typography-text>创建站点后,商城dist压缩包解压</a-typography-text>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/9dad2e494eb34ddcab6b2e1da6a8e8f9.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-text
|
||||||
|
>注意:需要在站点的配置信息加上,要不然刷新会404</a-typography-text
|
||||||
|
>
|
||||||
|
<a-typography-paragraph code copyable
|
||||||
|
>try_files $uri $uri/ /index.html;</a-typography-paragraph
|
||||||
|
>
|
||||||
|
<a-typography-paragraph code copyable
|
||||||
|
>location /api/ { proxy_pass https://server.gxwebsoft.com/api/; #
|
||||||
|
这个是后台接口所在的地址 }</a-typography-paragraph
|
||||||
|
>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/df80098530c841d7a1139ab906dd754b.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
</a-collapse-panel>
|
||||||
|
<a-collapse-panel key="3" header="小程序端部署">
|
||||||
|
<a-typography-title :level="5">1.下载源代码</a-typography-title>
|
||||||
|
<a-typography-paragraph code copyable
|
||||||
|
>git clone
|
||||||
|
http://git.gxwebsoft.com/gxwebsoft/websoft-uniapp.git</a-typography-paragraph
|
||||||
|
>
|
||||||
|
<a-typography-title :level="5">2.配置接口信息</a-typography-title>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
根目录下的config/setting.ts文件
|
||||||
|
</a-typography-paragraph>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<a-image
|
||||||
|
width="40vw"
|
||||||
|
src="https://oss.wsdns.cn/20240607/def16cc9d3e347f6a1e7c10261c5b9e9.jpg"
|
||||||
|
/>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
</a-collapse-panel>
|
||||||
|
<!-- <a-collapse-panel key="4" header="H5端部署">-->
|
||||||
|
<!-- <p>{{ text }}</p>-->
|
||||||
|
<!-- </a-collapse-panel>-->
|
||||||
|
<!-- <a-collapse-panel key="5" header="App端部署">-->
|
||||||
|
<!-- <p>{{ text }}</p>-->
|
||||||
|
<!-- </a-collapse-panel>-->
|
||||||
|
</a-collapse>
|
||||||
|
</a-page-header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
import { getPageTitle } from '@/utils/common';
|
||||||
|
|
||||||
|
const text = `制作中...`;
|
||||||
|
const activeKey = ref(['1']);
|
||||||
|
|
||||||
|
watch(currentRoute, () => {}, { immediate: true });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'HelpInfo'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
31
src/views/help/docs/index.vue
Normal file
31
src/views/help/docs/index.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
|
<a-result title="内容整理中">
|
||||||
|
<template #icon>
|
||||||
|
<SmileTwoTone />
|
||||||
|
</template>
|
||||||
|
<div>内容整理中...</div>
|
||||||
|
</a-result>
|
||||||
|
</a-page-header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
import { getPageTitle } from '@/utils/common';
|
||||||
|
|
||||||
|
const text = `制作中...`;
|
||||||
|
const activeKey = ref(['1']);
|
||||||
|
|
||||||
|
watch(currentRoute, () => {}, { immediate: true });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'HelpInfo'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-result title="内容整理中">
|
|
||||||
<template #icon>
|
|
||||||
<SmileTwoTone />
|
|
||||||
</template>
|
|
||||||
<div>内容整理中...</div>
|
|
||||||
</a-result>
|
|
||||||
</a-page-header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref, watch } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ExclamationCircleOutlined,
|
|
||||||
SmileTwoTone
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import {
|
|
||||||
pageChatMessage,
|
|
||||||
removeChatMessage,
|
|
||||||
removeBatchChatMessage
|
|
||||||
} from '@/api/system/chatMessage';
|
|
||||||
import type {
|
|
||||||
ChatMessage,
|
|
||||||
ChatMessageParam
|
|
||||||
} from '@/api/system/chatMessage/model';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
const { currentRoute } = useRouter();
|
|
||||||
import { getPageTitle, getUserId } from '@/utils/common';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ChatMessage[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ChatMessage | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 页面标题
|
|
||||||
const title = getPageTitle();
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
|
||||||
where.toUserId = getUserId();
|
|
||||||
return pageChatMessage({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '未/已读',
|
|
||||||
dataIndex: 'status',
|
|
||||||
key: 'status',
|
|
||||||
align: 'center',
|
|
||||||
width: 90
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '消息内容',
|
|
||||||
dataIndex: 'content',
|
|
||||||
key: 'content'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '发送人',
|
|
||||||
dataIndex: 'formUserName',
|
|
||||||
key: 'formUserName',
|
|
||||||
width: 180,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '发送时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 180,
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ChatMessageParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ChatMessage) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ChatMessage) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeChatMessage(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchChatMessage(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ChatMessage) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// openEdit(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
currentRoute,
|
|
||||||
() => {
|
|
||||||
reload();
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ChatMessage'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -142,9 +142,7 @@
|
|||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (props.data) {
|
if (props.data) {
|
||||||
const comments = decrypt(props.data.comments);
|
|
||||||
assignFields(props.data);
|
assignFields(props.data);
|
||||||
form.comments = comments;
|
|
||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
} else {
|
} else {
|
||||||
isUpdate.value = false;
|
isUpdate.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user