mirror of
https://github.com/1024-lab/smart-admin.git
synced 2026-06-02 03:55:59 +00:00
优化一波
This commit is contained in:
78
README.md
78
README.md
@@ -1,13 +1,11 @@
|
|||||||
### SmartAdmin
|
**SmartAdmin** 由**河南·洛阳 [1024 创新实验室](https://www.1024lab.net/)**使用SpringBoot2 和 Vue3 Setup语法糖、 Composition Api (同时支持JavaScript和TypeScript双版本) ,开发出的一套简洁、易用的低代码中后台解决方案!
|
||||||
|
|
||||||
SmartAdmin 由河南·洛阳 [1024 创新实验室](https://www.1024lab.net/)使用SpringBoot2 和 Vue3 Setup标签、 Composition Api (同时支持JavaScript和TypeScript双版本) ,开发出的一套简洁、易用的中后台解决方案!
|
|
||||||
|
|
||||||
**我们开源一套漂亮的代码和一套整洁的代码规范**,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!
|
**我们开源一套漂亮的代码和一套整洁的代码规范**,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!
|
||||||
|
|
||||||
### 地址
|
### 地址
|
||||||
|
|
||||||
在线预览: [http://preview.smartadmin.1024lab.net](http://preview.smartadmin.1024lab.net)
|
在线预览: [https://preview.smartadmin.vip](https://preview.smartadmin.vip)
|
||||||
部署文档:[https://smartadmin.1024lab.net](https://smartadmin.1024lab.net) (文档在努力更新中)
|
部署文档:[https://smartadmin.vip](https://smartadmin.vip)
|
||||||
vue2版本:请查看 feature/1.x 分支
|
vue2版本:请查看 feature/1.x 分支
|
||||||
|
|
||||||
### 理念与思想
|
### 理念与思想
|
||||||
@@ -15,35 +13,25 @@ vue2版本:请查看 feature/1.x 分支
|
|||||||
- 我们分享的不是徒劳无功的各种功能,而是必须有的功能,如:数据变动记录、系统说明文档、版本更新记录、意见反馈、日志、心跳、单号生成器等等。
|
- 我们分享的不是徒劳无功的各种功能,而是必须有的功能,如:数据变动记录、系统说明文档、版本更新记录、意见反馈、日志、心跳、单号生成器等等。
|
||||||
- 我们分享的还有经过上百家公司验证过的前端、后端、vue3等代码规范,好的规范能让我们敲下的每行代码更铿锵有力!
|
- 我们分享的还有经过上百家公司验证过的前端、后端、vue3等代码规范,好的规范能让我们敲下的每行代码更铿锵有力!
|
||||||
- **我们推崇高质量的代码,身为开发,代码即利剑,键盘上一套行云流水,宛如侠客,事了拂衣去,深藏身与名。**
|
- **我们推崇高质量的代码,身为开发,代码即利剑,键盘上一套行云流水,宛如侠客,事了拂衣去,深藏身与名。**
|
||||||
- **我们推崇团队的高度配合默契、互相帮助,从不加班,而不是一看到别人的代码就头皮发麻,留其 [996.ICU](https://baike.baidu.com/item/996.ICU)**
|
- **我们推崇团队的高度配合默契、互相帮助,从不加班,而不是一看到别人的代码就头皮发麻,留其 [996.ICU](https://baike.baidu.com/item/996.ICU),我们热爱代码,更热爱生活**
|
||||||
- **我们主动思考,保持谦逊,保持学习,热爱代码,更热爱生活。**
|
|
||||||
- <font color="#DC143C">**我们希望你,希望你能花费3分钟认真阅读下面的每一个点,让你感受从未有过的技术体验!**</font>
|
|
||||||
|
|
||||||
### 演示图
|
### 演示图
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/1-1.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/1-1.png"/></td>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/1-2.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/2-1.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/2-1.png"/></td>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/2-2.png"/></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/3-1.png"/></td>
|
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/3-2.png"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/4-1.png"/></td>
|
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/4-2.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/4-2.png"/></td>
|
||||||
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/3-1.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/5-1.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/5-1.png"/></td>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/5-2.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/6-1.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/6-1.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/code1.png"/></td>
|
||||||
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/6-2.png"/></td>
|
<td><img src="https://gitee.com/lab1024/smart-admin/raw/master/%E6%88%AA%E5%9B%BE/code2.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@@ -63,45 +51,35 @@ vue2版本:请查看 feature/1.x 分支
|
|||||||
- 系统:员工、部门、角色、权限、菜单 等
|
- 系统:员工、部门、角色、权限、菜单 等
|
||||||
- 工具:文件管理、系统参数、数据字典、单号生成 等
|
- 工具:文件管理、系统参数、数据字典、单号生成 等
|
||||||
- 代码生成: 基于每个表的配置、在线预览代码、下载 等
|
- 代码生成: 基于每个表的配置、在线预览代码、下载 等
|
||||||
|
- 更多请查看:[SmartAdmin 业内独有功能亮点](https://smartadmin.vip/views/v2/base/FunctionFeature.html)
|
||||||
|
|
||||||
### 前端特点
|
### 前端特点
|
||||||
|
|
||||||
- vue3.2 Composition 模式中如何正确的写好并组织好代码
|
- 提供 js 和 ts 双版本,目录结构及其清晰
|
||||||
- 提供 js 和 ts 双版本,清晰的代码结构
|
- setup语法糖下Composition Api 代码规范可能只有我们写对了
|
||||||
- 漂亮的 UI,菜单栏、标签页,体验、交互更好用的员工、部门、角色、菜单管理等等
|
|
||||||
- 多种布局layout模式
|
|
||||||
- 前端常量维护: vue-enum,拒绝出现魔法数字,常量枚举不可维护的现象
|
- 前端常量维护: vue-enum,拒绝出现魔法数字,常量枚举不可维护的现象
|
||||||
- main.js 中正确的加载方式
|
- 非常漂亮的首页、业内独有的帮助文档、数据变动记录、水印等
|
||||||
- 漂亮的首页、很好的帮助文档功能、等等,太多好的细节需要你的发现......
|
- 业内独有的用户表格自定义列,且保存到数据库
|
||||||
|
- 业内最好的api、常量、等写法
|
||||||
|
- 独有的本地、开发、测试、预发布、生产 5个env环境配置文件
|
||||||
|
- 业内代码最清晰的layout布局写法
|
||||||
|
- 业内可能只有我们把main.js中的router加载方式写对了
|
||||||
|
- [以上只是一些举例,更多灿若繁星的惊喜和细节,等待着你的发现!](https://smartadmin.vip/views/v2/base/CodeFeature.html)
|
||||||
|
|
||||||
|
|
||||||
### 后端特点
|
### 后端特点
|
||||||
|
|
||||||
- 高质量的 Java 代码、分包结构、和代码注释
|
- 高质量的 Java 代码、分包结构、和代码注释
|
||||||
- 业内独创的请求返回码维护,非常值得一看
|
- 业内独创的请求返回码维护,非常值得一看
|
||||||
- 四层架构(controller, service, manager, dao)
|
- 四层架构(controller, service, manager, dao),为什么要有四层
|
||||||
- 配合前端 vue-enum 的 swagger 文档注解
|
|
||||||
- 心跳服务,让你发现有哪些机器再跑,哪些人在偷偷的跑你的 Job
|
|
||||||
- smart-reload,为系统预留钩子,动态加载,在不重启程序前提下执行一些代码,你懂的
|
|
||||||
- 以上只是一些举例,更多灿若繁星的惊喜和细节,等待着你的发现!
|
|
||||||
|
|
||||||
### 前端代码规范
|
|
||||||
|
|
||||||
- vue3 项目目录结构如何划分
|
|
||||||
- Composition setup 模式下如何编写代码
|
|
||||||
- 文件、文件夹、目录结构、组件、变量等等怎么命名
|
|
||||||
- router 和 store ( pinia ) 该怎么划分扩展性更好
|
|
||||||
- 网络请求 axios 如何封装
|
|
||||||
- 以及更多,数不胜数让你觉得实用,同时身心愉悦的规范
|
|
||||||
|
|
||||||
### 后端代码规范
|
|
||||||
|
|
||||||
- 四层架构(controller, service, manager, dao) 是什么,为什么要有四层
|
|
||||||
- 各个层的代码该怎么写才能让团队配合默契,高度一致
|
|
||||||
- vo, bo, form, entity ,各种 javabean 怎么区分和使用
|
- vo, bo, form, entity ,各种 javabean 怎么区分和使用
|
||||||
- spring 的 @Transactional 你用对了吗
|
- 基于git diff的数据变更留痕功能,忘掉鸡肋的操作记录吧
|
||||||
- 方法参数个数、注释、todo 这些也要有规范,你遵守过吗
|
- 心跳服务,让你发现有哪些机器再跑,哪些人在偷偷的跑你的 Job
|
||||||
- 数据库列如何命名等等
|
- 支持接口加密解密注解、接口重复提交
|
||||||
- 以上举例,只是沧海一粟,更多的细节等待你的发现!
|
- maven多环境:开发、测试、预发布、生产 环境配置
|
||||||
|
- smart-reload,为系统预留钩子,动态加载,在不重启程序前提下执行一些代码
|
||||||
|
- [以上举例,只是沧海一粟,更多的细节等待你的发现!](https://smartadmin.vip/views/v2/base/CodeFeature.html)
|
||||||
|
|
||||||
|
|
||||||
ps:以上规范基础都是以团队出发,让团队开心快乐的写代码,而不是为了代码规范而规范,不喜勿喷!谢谢。
|
ps:以上规范基础都是以团队出发,让团队开心快乐的写代码,而不是为了代码规范而规范,不喜勿喷!谢谢。
|
||||||
|
|
||||||
@@ -123,5 +101,5 @@ ps:以上规范基础都是以团队出发,让团队开心快乐的写代码
|
|||||||
### 作者
|
### 作者
|
||||||
|
|
||||||
[1024创新实验室-主任:卓大](https://zhuoda.vip),混迹于各个技术圈,研究过计算机,熟悉点 java,略懂点前端。
|
[1024创新实验室-主任:卓大](https://zhuoda.vip),混迹于各个技术圈,研究过计算机,熟悉点 java,略懂点前端。
|
||||||
[1024创新实验室(河南·洛阳)](https://1024lab.net) 致力于成为中原领先、国内一流的技术团队,以技术创新为驱动,合作各类项目。
|
[1024创新实验室(河南·洛阳)](https://1024lab.net) 致力于成为中原领先、国内一流的技术团队,以技术创新为驱动,合作各类项目(软件外包、技术顾问、培训等等)。
|
||||||
|
|
||||||
|
|||||||
@@ -29,33 +29,33 @@
|
|||||||
WHERE notice_id = #{noticeId}
|
WHERE notice_id = #{noticeId}
|
||||||
</update>
|
</update>
|
||||||
<select id="queryPage" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
<select id="queryPage" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
||||||
SELECT tn.*,
|
SELECT t_notice.*,
|
||||||
e.actual_name AS createUserName
|
t_employee.actual_name AS createUserName
|
||||||
FROM t_notice tn
|
FROM t_notice
|
||||||
LEFT JOIN t_employee e ON tn.create_user_id = e.employee_id
|
LEFT JOIN t_employee ON t_notice.create_user_id = t_employee.employee_id
|
||||||
<where>
|
<where>
|
||||||
tn.deleted_flag = #{queryForm.deletedFlag}
|
t_notice.deleted_flag = #{queryForm.deletedFlag}
|
||||||
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
<if test="queryForm.keywords != null and queryForm.keywords != ''">
|
||||||
AND (INSTR(tn.notice_title,#{queryForm.keywords}) OR INSTR(e.actual_name,#{queryForm.keywords}))
|
AND (INSTR(t_notice.notice_title,#{queryForm.keywords}) OR INSTR(t_employee.actual_name,#{queryForm.keywords}))
|
||||||
</if>
|
</if>
|
||||||
<if test="queryForm.noticeType != null">
|
<if test="queryForm.noticeType != null">
|
||||||
AND tn.notice_type = #{queryForm.noticeType}
|
AND t_notice.notice_type = #{queryForm.noticeType}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryForm.noticeBelongType != null">
|
<if test="queryForm.noticeBelongType != null">
|
||||||
AND tn.notice_belong_type = #{queryForm.noticeBelongType}
|
AND t_notice.notice_belong_type = #{queryForm.noticeBelongType}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryForm.startTime != null">
|
<if test="queryForm.startTime != null">
|
||||||
AND DATE_FORMAT(tn.publish_time, '%Y-%m-%d') >= #{queryForm.startTime}
|
AND DATE_FORMAT(t_notice.publish_time, '%Y-%m-%d') >= #{queryForm.startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryForm.endTime != null">
|
<if test="queryForm.endTime != null">
|
||||||
AND DATE_FORMAT(tn.publish_time, '%Y-%m-%d') <= #{queryForm.endTime}
|
AND DATE_FORMAT(t_notice.publish_time, '%Y-%m-%d') <= #{queryForm.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryForm.disabledFlag != null">
|
<if test="queryForm.disabledFlag != null">
|
||||||
AND tn.disabled_flag = #{queryForm.disabledFlag}
|
AND t_notice.disabled_flag = #{queryForm.disabledFlag}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
<if test="queryForm.sortItemList == null or queryForm.sortItemList.size == 0">
|
<if test="queryForm.sortItemList == null or queryForm.sortItemList.size == 0">
|
||||||
ORDER BY tn.top_flag DESC,tn.publish_time DESC
|
ORDER BY t_notice.top_flag DESC,t_notice.publish_time DESC
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="getDetail" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
<select id="getDetail" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ public abstract class AbstractSecurityConfig extends WebSecurityConfigurerAdapte
|
|||||||
// token filter 进行校验
|
// token filter 进行校验
|
||||||
httpSecurity.addFilterBefore(new SecurityTokenFilter(this.userFunction()), UsernamePasswordAuthenticationFilter.class);
|
httpSecurity.addFilterBefore(new SecurityTokenFilter(this.userFunction()), UsernamePasswordAuthenticationFilter.class);
|
||||||
httpSecurity.addFilterBefore(corsFilter, SecurityTokenFilter.class);
|
httpSecurity.addFilterBefore(corsFilter, SecurityTokenFilter.class);
|
||||||
|
// 禁用spring security 使用 X-Frame-Options防止网页被Frame
|
||||||
|
httpSecurity.headers().frameOptions().disable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
SmartAdmin v2.X ,作者:1024创新实验室 @copyright:【 1024lab 】
|
SmartAdmin v2.X ,作者:1024创新实验室 @copyright:【 1024lab 】
|
||||||
|
|
||||||
SmartAdmin 文档地址:https://smartadmin.1024lab.net
|
SmartAdmin 文档地址:https://smartadmin.vip
|
||||||
|
|
||||||
1024创新实验室:https://www.1024lab.net
|
1024创新实验室:https://www.1024lab.net
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
VITE_APP_API_URL = 'http://preview.smartadmin.1024lab.net/smart-admin-api'
|
VITE_APP_API_URL = 'https://preview.smartadmin.vip/smart-admin-api'
|
||||||
|
|
||||||
VITE_APP_PROJECT_TITLE = 'SmartAdmin V2.X'
|
VITE_APP_PROJECT_TITLE = 'SmartAdmin V2.X'
|
||||||
|
|
||||||
|
|||||||
BIN
smart-admin-web/javascript-ant-design-vue3/dist.zip
Normal file
BIN
smart-admin-web/javascript-ant-design-vue3/dist.zip
Normal file
Binary file not shown.
@@ -9,14 +9,17 @@
|
|||||||
*
|
*
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<a-modal title="文件预览" v-model:visible="visibleFlag" :width="768" @cancel="onClose">
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<img class="img-prev" :src="previewUrl" />
|
<a-image
|
||||||
|
class="img-prev"
|
||||||
|
:style="{ display: 'none' }"
|
||||||
|
:preview="{
|
||||||
|
visible,
|
||||||
|
onVisibleChange: setVisible,
|
||||||
|
}"
|
||||||
|
:src="previewUrl"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
|
||||||
<a-button @click="onClose">关闭</a-button>
|
|
||||||
</template>
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -26,7 +29,6 @@
|
|||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||||
|
|
||||||
const visibleFlag = ref(false);
|
|
||||||
const imgFileType = ['jpg', 'jpeg', 'png', 'gif'];
|
const imgFileType = ['jpg', 'jpeg', 'png', 'gif'];
|
||||||
const previewUrl = ref();
|
const previewUrl = ref();
|
||||||
|
|
||||||
@@ -49,10 +51,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const visible = ref(false);
|
||||||
|
const setVisible = (value) => {
|
||||||
|
visible.value = value;
|
||||||
|
};
|
||||||
|
|
||||||
function showFile(fileItem) {
|
function showFile(fileItem) {
|
||||||
if (isImg(fileItem.fileType)) {
|
if (isImg(fileItem.fileType)) {
|
||||||
previewUrl.value = fileItem.fileUrl;
|
previewUrl.value = fileItem.fileUrl;
|
||||||
visibleFlag.value = true;
|
setVisible(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
download(fileItem.fileName, fileItem.fileUrl);
|
download(fileItem.fileName, fileItem.fileUrl);
|
||||||
@@ -63,10 +70,6 @@
|
|||||||
return imgFileType.includes(fileType);
|
return imgFileType.includes(fileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClose() {
|
|
||||||
visibleFlag.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showPreview,
|
showPreview,
|
||||||
});
|
});
|
||||||
@@ -77,11 +80,5 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
.img-prev {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: 600px;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -14,4 +14,11 @@ export default {
|
|||||||
antdLocale: antd,
|
antdLocale: antd,
|
||||||
dayjsLocale: dayjs,
|
dayjsLocale: dayjs,
|
||||||
'setting.title': 'Setting',
|
'setting.title': 'Setting',
|
||||||
|
'setting.menu.layout': 'Menu Layout',
|
||||||
|
'setting.menu.width': 'Menu Width',
|
||||||
|
'setting.menu.theme': 'Menu Theme',
|
||||||
|
'setting.bread': 'Show Bread',
|
||||||
|
'setting.pagetag': 'Show PageTag',
|
||||||
|
'setting.footer': 'Show Footer',
|
||||||
|
'setting.helpdoc': 'Show Helpdoc',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,4 +14,11 @@ export default {
|
|||||||
antdLocale: antd,
|
antdLocale: antd,
|
||||||
dayjsLocale: dayjs,
|
dayjsLocale: dayjs,
|
||||||
'setting.title': '网站设置',
|
'setting.title': '网站设置',
|
||||||
|
'setting.menu.layout': '菜单布局',
|
||||||
|
'setting.menu.width': '菜单宽度',
|
||||||
|
'setting.menu.theme': '菜单主题',
|
||||||
|
'setting.bread': '面包屑',
|
||||||
|
'setting.pagetag': '标签页',
|
||||||
|
'setting.footer': '页脚',
|
||||||
|
'setting.helpdoc': '帮助文档',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,33 +16,33 @@
|
|||||||
<a-select-option v-for="item in i18nList" :key="item.value" :value="item.value">{{ item.text }}</a-select-option>
|
<a-select-option v-for="item in i18nList" :key="item.value" :value="item.value">{{ item.text }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="菜单布局">
|
<a-form-item :label="$t('setting.menu.layout')">
|
||||||
<a-radio-group @change="changeLayout" button-style="solid" v-model:value="formState.layout">
|
<a-radio-group @change="changeLayout" button-style="solid" v-model:value="formState.layout">
|
||||||
<a-radio-button v-for="item in $smartEnumPlugin.getValueDescList('LAYOUT_ENUM')" :key="item.value" :value="item.value">
|
<a-radio-button v-for="item in $smartEnumPlugin.getValueDescList('LAYOUT_ENUM')" :key="item.value" :value="item.value">
|
||||||
{{ item.desc }}
|
{{ item.desc }}
|
||||||
</a-radio-button>
|
</a-radio-button>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="菜单宽度" v-if="formState.layout === LAYOUT_ENUM.SIDE.value">
|
<a-form-item :label="$t('setting.menu.width')" v-if="formState.layout === LAYOUT_ENUM.SIDE.value">
|
||||||
<a-input-number @change="changeSideMenuWidth" v-model:value="formState.sideMenuWidth" :min="1" />
|
<a-input-number @change="changeSideMenuWidth" v-model:value="formState.sideMenuWidth" :min="1" />
|
||||||
像素(px)
|
像素(px)
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="菜单主题">
|
<a-form-item :label="$t('setting.menu.theme')">
|
||||||
<a-radio-group v-model:value="formState.sideMenuTheme" button-style="solid" @change="changeMenuTheme">
|
<a-radio-group v-model:value="formState.sideMenuTheme" button-style="solid" @change="changeMenuTheme">
|
||||||
<a-radio-button value="dark">Dark</a-radio-button>
|
<a-radio-button value="dark">Dark</a-radio-button>
|
||||||
<a-radio-button value="light">Light</a-radio-button>
|
<a-radio-button value="light">Light</a-radio-button>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="面包屑">
|
<a-form-item :label="$t('setting.bread')">
|
||||||
<a-switch @change="changeBreadCrumbFlag" v-model:checked="formState.breadCrumbFlag" checked-children="显示" un-checked-children="隐藏" />
|
<a-switch @change="changeBreadCrumbFlag" v-model:checked="formState.breadCrumbFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="标签页">
|
<a-form-item :label="$t('setting.pagetag')">
|
||||||
<a-switch @change="changePageTagFlag" v-model:checked="formState.pageTagFlag" checked-children="显示" un-checked-children="隐藏" />
|
<a-switch @change="changePageTagFlag" v-model:checked="formState.pageTagFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="页脚">
|
<a-form-item :label="$t('setting.footer')">
|
||||||
<a-switch @change="changeFooterFlag" v-model:checked="formState.footerFlag" checked-children="显示" un-checked-children="隐藏" />
|
<a-switch @change="changeFooterFlag" v-model:checked="formState.footerFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="帮助文档">
|
<a-form-item :label="$t('setting.helpdoc')">
|
||||||
<a-switch @change="changeHelpDocFlag" v-model:checked="formState.helpDocFlag" checked-children="显示" un-checked-children="隐藏" />
|
<a-switch @change="changeHelpDocFlag" v-model:checked="formState.helpDocFlag" checked-children="显示" un-checked-children="隐藏" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<!-----文档列表---->
|
<!-----文档列表---->
|
||||||
<div class="help-doc-list">
|
<div class="help-doc-list">
|
||||||
<div class="help-doc-item-all">
|
<div class="help-doc-item-all">
|
||||||
<router-link tag="a" target="_blank" :to="{ path: '/help-doc/detail' }">查看全部文档 >></router-link>
|
<router-link tag="a" target="_blank" :to="{ path: '/help-doc/detail' }">系统手册文档 >></router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="help-doc-item" v-for="item in helpDocList" :key="item.helpDocId">
|
<div class="help-doc-item" v-for="item in helpDocList" :key="item.helpDocId">
|
||||||
<router-link tag="a" target="_blank" :to="{ path: '/help-doc/detail', query: { helpDocId: item.helpDocId } }">{{ item.title }}</router-link>
|
<router-link tag="a" target="_blank" :to="{ path: '/help-doc/detail', query: { helpDocId: item.helpDocId } }">{{ item.title }}</router-link>
|
||||||
@@ -64,7 +64,8 @@
|
|||||||
import FeedbackModal from './components/feedback-modal.vue';
|
import FeedbackModal from './components/feedback-modal.vue';
|
||||||
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
import { useAppConfigStore } from '/@/store/modules/system/app-config';
|
||||||
import { feedbackApi } from '/@/api/support/feedback/feedback-api';
|
import { feedbackApi } from '/@/api/support/feedback/feedback-api';
|
||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { HOME_PAGE_NAME } from '/@/constants/system/home-const';
|
||||||
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
|
|
||||||
function hideHelpDoc() {
|
function hideHelpDoc() {
|
||||||
useAppConfigStore().hideHelpDoc();
|
useAppConfigStore().hideHelpDoc();
|
||||||
@@ -142,11 +143,15 @@ import { smartSentry } from '/@/lib/smart-sentry';
|
|||||||
//SmartAdmin中 router的name 就是 后端存储menu的id
|
//SmartAdmin中 router的name 就是 后端存储menu的id
|
||||||
let menuId = -1;
|
let menuId = -1;
|
||||||
try {
|
try {
|
||||||
menuId = _.toNumber(currentRoute.name);
|
if(currentRoute.name === HOME_PAGE_NAME){
|
||||||
|
menuId = 0;
|
||||||
|
}else{
|
||||||
|
menuId = _.toNumber(currentRoute.name);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
smartSentry.captureError(e);
|
smartSentry.captureError(e);
|
||||||
}
|
}
|
||||||
if (menuId > 0) {
|
if (menuId > -1) {
|
||||||
queryHelpDocList(menuId);
|
queryHelpDocList(menuId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ import { useUserStore } from '/@/store/modules/system/user';
|
|||||||
import '/@/theme/index.less';
|
import '/@/theme/index.less';
|
||||||
import { getTokenFromCookie } from '/@/utils/cookie-util';
|
import { getTokenFromCookie } from '/@/utils/cookie-util';
|
||||||
|
|
||||||
|
let url = location.href;
|
||||||
|
if(url.indexOf('1024lab.net') > -1){
|
||||||
|
location.href = "https://preview.smartadmin.vip";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------- ※ 着重 解释说明下main.js的初始化逻辑 begin ※ --------------------
|
* -------------------- ※ 着重 解释说明下main.js的初始化逻辑 begin ※ --------------------
|
||||||
|
|||||||
@@ -172,7 +172,7 @@
|
|||||||
function onSearch(){
|
function onSearch(){
|
||||||
queryForm.pageNum = 1;
|
queryForm.pageNum = 1;
|
||||||
ajaxQuery();
|
ajaxQuery();
|
||||||
},
|
}
|
||||||
async function ajaxQuery() {
|
async function ajaxQuery() {
|
||||||
try {
|
try {
|
||||||
tableLoading.value = true;
|
tableLoading.value = true;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:title="formData.helpDocId ? '编辑' : '新建'"
|
:title="formData.helpDocId ? '编辑系统手册' : '新建系统手册'"
|
||||||
:visible="visibleFlag"
|
:visible="visibleFlag"
|
||||||
:width="1000"
|
:width="1000"
|
||||||
:footerStyle="{ textAlign: 'right' }"
|
:footerStyle="{ textAlign: 'right' }"
|
||||||
@@ -29,7 +29,13 @@
|
|||||||
<a-form-item label="排序" name="sort">
|
<a-form-item label="排序" name="sort">
|
||||||
<a-input-number v-model:value="formData.sort" placeholder="值越小越靠前" />(值越小越靠前)
|
<a-input-number v-model:value="formData.sort" placeholder="值越小越靠前" />(值越小越靠前)
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="关联菜单">
|
<a-form-item label="是否首页显示">
|
||||||
|
<a-radio-group v-model:value="relateHomeFlag" button-style="solid">
|
||||||
|
<a-radio-button :value="true">首页显示</a-radio-button>
|
||||||
|
<a-radio-button :value="false">首页不用显示</a-radio-button>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="关联菜单" v-if="!relateHomeFlag">
|
||||||
<MenuTreeSelect v-model:value="formData.relationIdList" ref="menuTreeSelect" />
|
<MenuTreeSelect v-model:value="formData.relationIdList" ref="menuTreeSelect" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="公告内容" name="contentHtml">
|
<a-form-item label="公告内容" name="contentHtml">
|
||||||
@@ -69,7 +75,7 @@
|
|||||||
import HelpDocCatalogTreeSelect from './help-doc-catalog-tree-select.vue';
|
import HelpDocCatalogTreeSelect from './help-doc-catalog-tree-select.vue';
|
||||||
import MenuTreeSelect from '/@/components/system/menu-tree-select/index.vue';
|
import MenuTreeSelect from '/@/components/system/menu-tree-select/index.vue';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
|
|
||||||
const emits = defineEmits(['reloadList']);
|
const emits = defineEmits(['reloadList']);
|
||||||
|
|
||||||
@@ -99,6 +105,7 @@ import { smartSentry } from '/@/lib/smart-sentry';
|
|||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const contentRef = ref();
|
const contentRef = ref();
|
||||||
const noticeFormVisibleModal = ref();
|
const noticeFormVisibleModal = ref();
|
||||||
|
const relateHomeFlag = ref(false);
|
||||||
|
|
||||||
const defaultFormData = {
|
const defaultFormData = {
|
||||||
helpDocId: undefined,
|
helpDocId: undefined,
|
||||||
@@ -135,6 +142,11 @@ import { smartSentry } from '/@/lib/smart-sentry';
|
|||||||
}
|
}
|
||||||
Object.assign(formData, result.data);
|
Object.assign(formData, result.data);
|
||||||
formData.relationIdList = result.data.relationList ? result.data.relationList.map((e) => e.relationId) : [];
|
formData.relationIdList = result.data.relationList ? result.data.relationList.map((e) => e.relationId) : [];
|
||||||
|
if (formData.relationIdList.length === 1 && formData.relationIdList[0].relationId === 0) {
|
||||||
|
relateHomeFlag.value = true;
|
||||||
|
} else {
|
||||||
|
relateHomeFlag.value = false;
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
smartSentry.captureError(err);
|
smartSentry.captureError(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -161,8 +173,18 @@ import { smartSentry } from '/@/lib/smart-sentry';
|
|||||||
try {
|
try {
|
||||||
SmartLoading.show();
|
SmartLoading.show();
|
||||||
let param = _.cloneDeep(formData);
|
let param = _.cloneDeep(formData);
|
||||||
let relationList = menuTreeSelect.value.getMenuListByIdList(formData.relationIdList);
|
// 首页显示的话,为0
|
||||||
param.relationList = relationList.map((e) => Object.assign({}, { relationId: e.menuId, relationName: e.menuName }));
|
if (relateHomeFlag.value) {
|
||||||
|
param.relationList = [
|
||||||
|
{
|
||||||
|
relationName: '首页',
|
||||||
|
relationId: 0,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
let relationList = menuTreeSelect.value.getMenuListByIdList(formData.relationIdList);
|
||||||
|
param.relationList = relationList.map((e) => Object.assign({}, { relationId: e.menuId, relationName: e.menuName }));
|
||||||
|
}
|
||||||
|
|
||||||
if (param.helpDocId) {
|
if (param.helpDocId) {
|
||||||
await helpDocApi.update(param);
|
await helpDocApi.update(param);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
<div>
|
<div>
|
||||||
关键字:
|
关键字:
|
||||||
<a-input style="width: 250px" v-model:value="queryForm.keywords" placeholder="姓名/手机号/登录账号" />
|
<a-input style="width: 250px" v-model:value="queryForm.keywords" placeholder="姓名/手机号/登录账号" />
|
||||||
|
|
||||||
<a-button class="button-style" v-if="selectRoleId" type="primary" @click="queryRoleEmployee">搜索</a-button>
|
<a-button class="button-style" v-if="selectRoleId" type="primary" @click="queryRoleEmployee">搜索</a-button>
|
||||||
<a-button class="button-style" v-if="selectRoleId" type="default" @click="resetQueryRoleEmployee">重置</a-button>
|
<a-button class="button-style" v-if="selectRoleId" type="default" @click="resetQueryRoleEmployee">重置</a-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a-table
|
<a-table
|
||||||
:loading="tableLoading"
|
:loading="tableLoading"
|
||||||
:dataSource="tableData"
|
:dataSource="tableData"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<a-col flex="200px">
|
<a-col flex="200px">
|
||||||
<RoleList ref="roleList" />
|
<RoleList ref="roleList" />
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col flex="1">
|
<a-col flex="1" class="role-setting">
|
||||||
<RoleSetting />
|
<RoleSetting />
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -42,4 +42,7 @@
|
|||||||
.height100 {
|
.height100 {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.role-setting{
|
||||||
|
width:calc(100% - 250px)
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<!--
|
<!--
|
||||||
* 首页 用户头部信息
|
* 首页 用户头部信息
|
||||||
*
|
*
|
||||||
* @Author: 1024创新实验室-主任:卓大
|
* @Author: 1024创新实验室-主任:卓大
|
||||||
* @Date: 2022-09-12 22:34:00
|
* @Date: 2022-09-12 22:34:00
|
||||||
* @Wechat: zhuda1024
|
* @Wechat: zhuda1024
|
||||||
* @Email: lab1024@163.com
|
* @Email: lab1024@163.com
|
||||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||||
*
|
*
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
height="60"
|
height="60"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
allowtransparency="true"
|
allowtransparency="true"
|
||||||
src="//i.tianqi.com/index.php?c=code&id=12&icon=1&num=5&site=12"
|
src="//i.tianqi.com/index.php?c=code&id=12&icon=1&num=3&site=12"
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
.heart-sentence {
|
.heart-sentence {
|
||||||
width: calc(100% - 500px);
|
width: calc(100% - 420px);
|
||||||
h3 {
|
h3 {
|
||||||
color: rgba(0, 0, 0, 0.75);
|
color: rgba(0, 0, 0, 0.75);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.weather {
|
.weather {
|
||||||
width: 440px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,11 +70,12 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width:50%;
|
width: 50%;
|
||||||
> img {
|
> img {
|
||||||
width: 112px;
|
width: 112px;
|
||||||
height: 112px;
|
height: 112px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-desc {
|
.qr-desc {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -89,6 +90,37 @@
|
|||||||
margin-right: 9px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.qr-desc-marquee {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 11px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
color: #ffffff;
|
||||||
|
|
||||||
|
@keyframes marquee {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-220%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.marquee {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
animation: marquee 15s linear infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.login-title {
|
.login-title {
|
||||||
|
|||||||
@@ -15,9 +15,8 @@
|
|||||||
<p>欢迎登录 SmartAdmin V2</p>
|
<p>欢迎登录 SmartAdmin V2</p>
|
||||||
<p class="desc">
|
<p class="desc">
|
||||||
SmartAdmin 是由 河南·洛阳
|
SmartAdmin 是由 河南·洛阳
|
||||||
<a target="_blank" href="https://www.1024lab.net" style="color: white; weight: bolder; font-size: 15px; text-decoration: underline"
|
<a target="_blank" href="https://www.1024lab.net"
|
||||||
>1024创新实验室(1024Lab)</a
|
style="color: white; weight: bolder; font-size: 15px; text-decoration: underline">1024创新实验室(1024Lab)</a>
|
||||||
>
|
|
||||||
使用SpringBoot2.x 和 Vue3.2 Setup语法糖、 Composition Api (同时支持JavaScript和TypeScript双版本) ,开发出的一套简洁、易用的中后台解决方案!
|
使用SpringBoot2.x 和 Vue3.2 Setup语法糖、 Composition Api (同时支持JavaScript和TypeScript双版本) ,开发出的一套简洁、易用的中后台解决方案!
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -29,8 +28,9 @@
|
|||||||
保持谦逊,保持学习,热爱代码,更热爱生活 !<br />
|
保持谦逊,保持学习,热爱代码,更热爱生活 !<br />
|
||||||
永远年轻,永远前行 !<br />
|
永远年轻,永远前行 !<br />
|
||||||
<span class="author">
|
<span class="author">
|
||||||
<a target="_blank" href="https://zhuoda.vip" style="color: white; font-size: 13px; text-decoration: underline">
|
<a target="_blank" href="https://zhuoda.vip"
|
||||||
1024创新实验室-主任:卓大 ( 2022年 · 洛阳 )
|
style="color: white; font-size: 13px; text-decoration: underline">
|
||||||
|
1024创新实验室-主任:卓大
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="app-qr">
|
<div class="app-qr">
|
||||||
<img :src="xiaozhen" />
|
<img :src="xiaozhen" />
|
||||||
<marquee class="qr-desc" scrolldelay="130"> 关注:小镇程序员,了解二三线城市程序员的代码与“钱途”,技术与生活,城市可能无法选择,但未来可以拼搏。</marquee>
|
<div class="qr-desc-marquee"><div class="marquee"><span>关注:小镇程序员,了解二三线城市程序员的代码与“钱途”,技术与生活,城市可能无法选择,但未来可以拼搏。</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,12 +55,8 @@
|
|||||||
<a-input v-model:value.trim="loginForm.loginName" placeholder="请输入用户名" />
|
<a-input v-model:value.trim="loginForm.loginName" placeholder="请输入用户名" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item name="password">
|
<a-form-item name="password">
|
||||||
<a-input-password
|
<a-input-password v-model:value="loginForm.password" autocomplete="on"
|
||||||
v-model:value="loginForm.password"
|
:type="showPassword ? 'text' : 'password'" placeholder="请输入密码" />
|
||||||
autocomplete="on"
|
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
placeholder="请输入密码"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item name="captchaCode">
|
<a-form-item name="captchaCode">
|
||||||
<a-input class="captcha-input" v-model:value.trim="loginForm.captchaCode" placeholder="请输入验证码" />
|
<a-input class="captcha-input" v-model:value.trim="loginForm.captchaCode" placeholder="请输入验证码" />
|
||||||
@@ -88,119 +84,117 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { loginApi } from '/@/api/system/login/login-api';
|
import { loginApi } from '/@/api/system/login/login-api';
|
||||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||||
import { LOGIN_DEVICE_ENUM } from '/@/constants/system/login-device-const';
|
import { LOGIN_DEVICE_ENUM } from '/@/constants/system/login-device-const';
|
||||||
import { useUserStore } from '/@/store/modules/system/user';
|
import { useUserStore } from '/@/store/modules/system/user';
|
||||||
import { saveTokenToCookie } from '/@/utils/cookie-util';
|
import { saveTokenToCookie } from '/@/utils/cookie-util';
|
||||||
|
|
||||||
import gongzhonghao from '/@/assets/images/1024lab/1024lab-gzh.jpg';
|
import gongzhonghao from '/@/assets/images/1024lab/1024lab-gzh.jpg';
|
||||||
import zhuoda from '/@/assets/images/1024lab/zhuoda-wechat.jpg';
|
import zhuoda from '/@/assets/images/1024lab/zhuoda-wechat.jpg';
|
||||||
import loginQR from '/@/assets/images/login/login-qr.png';
|
import loginQR from '/@/assets/images/login/login-qr.png';
|
||||||
import xiaozhen from '/@/assets/images/1024lab/xiaozhen-gzh.jpg';
|
import xiaozhen from '/@/assets/images/1024lab/xiaozhen-gzh.jpg';
|
||||||
|
|
||||||
import aliLogin from '/@/assets/images/login/ali-icon.png';
|
import aliLogin from '/@/assets/images/login/ali-icon.png';
|
||||||
import googleLogin from '/@/assets/images/login/google-icon.png';
|
import googleLogin from '/@/assets/images/login/google-icon.png';
|
||||||
import qqLogin from '/@/assets/images/login/qq-icon.png';
|
import qqLogin from '/@/assets/images/login/qq-icon.png';
|
||||||
import weiboLogin from '/@/assets/images/login/weibo-icon.png';
|
import weiboLogin from '/@/assets/images/login/weibo-icon.png';
|
||||||
|
|
||||||
import { buildRoutes } from '/@/router/index';
|
import { buildRoutes } from '/@/router/index';
|
||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
|
|
||||||
//--------------------- 登录表单 ---------------------------------
|
//--------------------- 登录表单 ---------------------------------
|
||||||
|
|
||||||
const loginForm = reactive({
|
const loginForm = reactive({
|
||||||
loginName: 'admin',
|
loginName: 'admin',
|
||||||
password: '',
|
password: '',
|
||||||
captchaCode: '',
|
captchaCode: '',
|
||||||
captchaUuid: '',
|
captchaUuid: '',
|
||||||
loginDevice: LOGIN_DEVICE_ENUM.PC.value,
|
loginDevice: LOGIN_DEVICE_ENUM.PC.value,
|
||||||
});
|
});
|
||||||
const rules = {
|
const rules = {
|
||||||
loginName: [{ required: true, message: '用户名不能为空' }],
|
loginName: [{ required: true, message: '用户名不能为空' }],
|
||||||
password: [{ required: true, message: '密码不能为空' }],
|
password: [{ required: true, message: '密码不能为空' }],
|
||||||
captchaCode: [{ required: true, message: '验证码不能为空' }],
|
captchaCode: [{ required: true, message: '验证码不能为空' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
const showPassword = ref(false);
|
||||||
|
const router = useRouter();
|
||||||
|
const formRef = ref();
|
||||||
|
const rememberPwd = ref(false);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
document.onkeyup = (e) => {
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
onLogin();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const showPassword = ref(false);
|
onUnmounted(() => {
|
||||||
const router = useRouter();
|
document.onkeyup = null;
|
||||||
const formRef = ref();
|
});
|
||||||
const rememberPwd = ref(false);
|
|
||||||
|
|
||||||
onMounted(() => {
|
//登录
|
||||||
document.onkeyup = (e) => {
|
async function onLogin() {
|
||||||
if (e.keyCode == 13) {
|
formRef.value.validate().then(async () => {
|
||||||
onLogin();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
document.onkeyup = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
//登录
|
|
||||||
async function onLogin() {
|
|
||||||
formRef.value.validate().then(async () => {
|
|
||||||
try {
|
|
||||||
SmartLoading.show();
|
|
||||||
const res = await loginApi.login(loginForm);
|
|
||||||
stopRefrestCaptchaInterval();
|
|
||||||
saveTokenToCookie(res.data.token ? res.data.token : '');
|
|
||||||
message.success('登录成功');
|
|
||||||
//更新用户信息到pinia
|
|
||||||
useUserStore().setUserLoginInfo(res.data);
|
|
||||||
//构建系统的路由
|
|
||||||
buildRoutes();
|
|
||||||
router.push('/home');
|
|
||||||
} catch (e) {
|
|
||||||
if (e.data && e.data.code === 30001) {
|
|
||||||
loginForm.captchaCode = '';
|
|
||||||
getCaptcha();
|
|
||||||
}
|
|
||||||
smartSentry.captureError(e);
|
|
||||||
} finally {
|
|
||||||
SmartLoading.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------- 验证码 ---------------------------------
|
|
||||||
|
|
||||||
const captchaBase64Image = ref('');
|
|
||||||
async function getCaptcha() {
|
|
||||||
try {
|
try {
|
||||||
let captchaResult = await loginApi.getCaptcha();
|
SmartLoading.show();
|
||||||
captchaBase64Image.value = captchaResult.data.captchaBase64Image;
|
const res = await loginApi.login(loginForm);
|
||||||
loginForm.captchaUuid = captchaResult.data.captchaUuid;
|
stopRefrestCaptchaInterval();
|
||||||
beginRefrestCaptchaInterval(captchaResult.data.expireSeconds);
|
saveTokenToCookie(res.data.token ? res.data.token : '');
|
||||||
|
message.success('登录成功');
|
||||||
|
//更新用户信息到pinia
|
||||||
|
useUserStore().setUserLoginInfo(res.data);
|
||||||
|
//构建系统的路由
|
||||||
|
buildRoutes();
|
||||||
|
router.push('/home');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
if (e.data && e.data.code === 30001) {
|
||||||
|
loginForm.captchaCode = '';
|
||||||
|
getCaptcha();
|
||||||
|
}
|
||||||
|
smartSentry.captureError(e);
|
||||||
|
} finally {
|
||||||
|
SmartLoading.hide();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let refrestCaptchaInterval = null;
|
//--------------------- 验证码 ---------------------------------
|
||||||
function beginRefrestCaptchaInterval(expireSeconds) {
|
|
||||||
if (refrestCaptchaInterval === null) {
|
|
||||||
refrestCaptchaInterval = setInterval(getCaptcha, (expireSeconds - 5) * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopRefrestCaptchaInterval() {
|
const captchaBase64Image = ref('');
|
||||||
if (refrestCaptchaInterval != null) {
|
async function getCaptcha() {
|
||||||
clearInterval(refrestCaptchaInterval);
|
try {
|
||||||
refrestCaptchaInterval = null;
|
let captchaResult = await loginApi.getCaptcha();
|
||||||
}
|
captchaBase64Image.value = captchaResult.data.captchaBase64Image;
|
||||||
|
loginForm.captchaUuid = captchaResult.data.captchaUuid;
|
||||||
|
beginRefrestCaptchaInterval(captchaResult.data.expireSeconds);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(getCaptcha);
|
let refrestCaptchaInterval = null;
|
||||||
|
function beginRefrestCaptchaInterval(expireSeconds) {
|
||||||
|
if (refrestCaptchaInterval === null) {
|
||||||
|
refrestCaptchaInterval = setInterval(getCaptcha, (expireSeconds - 5) * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopRefrestCaptchaInterval() {
|
||||||
|
if (refrestCaptchaInterval != null) {
|
||||||
|
clearInterval(refrestCaptchaInterval);
|
||||||
|
refrestCaptchaInterval = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(getCaptcha);
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>@import './login.less';</style>
|
||||||
@import './login.less';
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<!--
|
<!--
|
||||||
* 首页 用户头部信息
|
* 首页 用户头部信息
|
||||||
*
|
*
|
||||||
* @Author: 1024创新实验室-主任:卓大
|
* @Author: 1024创新实验室-主任:卓大
|
||||||
* @Date: 2022-09-12 22:34:00
|
* @Date: 2022-09-12 22:34:00
|
||||||
* @Wechat: zhuda1024
|
* @Wechat: zhuda1024
|
||||||
* @Email: lab1024@163.com
|
* @Email: lab1024@163.com
|
||||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||||
*
|
*
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
.heart-sentence {
|
.heart-sentence {
|
||||||
width: calc(100% - 500px);
|
width: calc(100% -660px);
|
||||||
h3 {
|
h3 {
|
||||||
color: rgba(0, 0, 0, 0.75);
|
color: rgba(0, 0, 0, 0.75);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.weather {
|
.weather {
|
||||||
width: 440px;
|
width: 650px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
截图/code1.png
Normal file
BIN
截图/code1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 555 KiB |
BIN
截图/code2.png
Normal file
BIN
截图/code2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 402 KiB |
Reference in New Issue
Block a user