Compare commits

..

1 Commits

Author SHA1 Message Date
xiaoxian521
98b97b9f88 release: update 3.9.4 2022-12-05 13:59:54 +08:00
34 changed files with 601 additions and 706 deletions

View File

@@ -1,23 +1,3 @@
# 3.9.5 (2022-12-13)
### ✔️ refactor
- completely removed `lodash` and its related libraries
[Click here to see Why Removed? How to integrate it yourself? ](https://yiming_chang.gitee.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-5-%E7 %89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-lodash-%E5%92%8C% E5%85%B6%E7%9B%B8%E5%85%B3%E5%BA%93-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9 %99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- Add `@pureadmin/table` table dynamic column example
### 🐞 Bug fixes
- Fix dynamic route `rank` issue
- Fix dark theme styling issues
### 🍏 Perf
- optimize the route `rank`, when `rank` does not exist, it will be created automatically according to the order, the home page route will always be the first
# 3.9.4 (2022-12-05)
### ✔️ refactor
@@ -25,10 +5,6 @@
- Completely removed `vxe-table`, after removal, the overall package size of the full version is reduced by `1.82MB`, and the initial startup time is basically the same as the lite version 🐮
[Click here to see Why Removed? How to integrate it yourself?](https://xiaoxian521.github.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-4-%E7%89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-vxe-table-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9%99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- Add `@pureadmin/table` table selector (single select, multiple select) example
# 3.9.3 (2022-12-04)
### 🎫 Feat

View File

@@ -1,23 +1,3 @@
# 3.9.5 (2022-12-13)
### ✔️ refactor
- completely removed `lodash` and its related libraries
[Click here to see Why Removed? How to integrate it yourself? ](https://yiming_chang.gitee.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-5-%E7 %89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-lodash-%E5%92%8C% E5%85%B6%E7%9B%B8%E5%85%B3%E5%BA%93-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9 %99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- Add `@pureadmin/table` table dynamic column example
### 🐞 Bug fixes
- Fix dynamic route `rank` issue
- Fix dark theme styling issues
### 🍏 Perf
- optimize the route `rank`, when `rank` does not exist, it will be created automatically according to the order, the home page route will always be the first
# 3.9.4 (2022-12-05)
### ✔️ refactor
@@ -25,10 +5,6 @@
- Completely removed `vxe-table`, after removal, the overall package size of the full version is reduced by `1.82MB`, and the initial startup time is basically the same as the lite version 🐮
[Click here to see Why Removed? How to integrate it yourself?](https://xiaoxian521.github.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-4-%E7%89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-vxe-table-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9%99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- Add `@pureadmin/table` table selector (single select, multiple select) example
# 3.9.3 (2022-12-04)
### 🎫 Feat

View File

@@ -1,23 +1,3 @@
# 3.9.5 (2022-12-13)
### ✔️ refactor
- 完全移除了 `lodash` 和其相关库
[点击此处查看为什么移除?如何自行集成?](https://yiming_chang.gitee.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-5-%E7%89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-lodash-%E5%92%8C%E5%85%B6%E7%9B%B8%E5%85%B3%E5%BA%93-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9%99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- 添加 `@pureadmin/table` 表格动态列示例
### 🐞 Bug fixes
- 修复动态路由 `rank` 问题
- 修复暗黑主题样式问题
### 🍏 Perf
- 优化路由 `rank` ,当 `rank` 不存在时,根据顺序自动创建,首页路由永远在第一位
# 3.9.4 (2022-12-05)
### ✔️ refactor
@@ -25,10 +5,6 @@
- 完全移除了 `vxe-table`,移除后,完整版整体打包大小减少 `1.82MB`,首启动时长基本和精简版持平 🐮
[点击此处查看为什么移除?如何自行集成?](https://yiming_chang.gitee.io/pure-admin-doc/pages/FAQ/#%E5%B9%B3%E5%8F%B0%E5%9C%A8-v3-9-4-%E7%89%88%E6%9C%AC%E5%AE%8C%E5%85%A8%E7%A7%BB%E9%99%A4%E4%BA%86-vxe-table-%E4%B8%BA%E4%BB%80%E4%B9%88%E7%A7%BB%E9%99%A4-%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E9%9B%86%E6%88%90)
### 🎫 Feat
- 添加 `@pureadmin/table` 表格选择器(单选、多选)示例
# 3.9.3 (2022-12-04)
### 🎫 Feat

View File

@@ -22,7 +22,7 @@
- [点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT)
- [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
## 配套保姆级文档(支持 `PWA` 快速、离线访问)
## 配套文档(支持 `PWA` 快速、离线访问)
- [点我查看国内文档站](https://yiming_chang.gitee.io/pure-admin-doc)
- [点我查看国外文档站](https://xiaoxian521.github.io/pure-admin-doc)

View File

@@ -7,7 +7,7 @@ import { Plugin as importToCDN } from "vite-plugin-cdn-import";
* 注意上面提到的仅限外网使用也不是完全肯定的如果你们公司内网部署的有相关js、css文件也可以将下面配置对应改一下整一套内网版cdn
*/
export const cdn = importToCDN({
//prodUrl解释 name: 对应下面modules的nameversion: 自动读取本地package.json中dependencies依赖中对应包的版本号path: 对应下面modules的path当然也可写完整路径会替换prodUrl
//prodUrl解释 name: 对应下面modules的nameversion: 自动读取本地package.json中dependencies依赖中对应包的版本号path: 对应下面modules的path
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
modules: [
{
@@ -56,6 +56,12 @@ export const cdn = importToCDN({
name: "echarts",
var: "echarts",
path: "echarts.min.js"
},
{
name: "lodash",
var: "lodash",
// 可写`完整路径`,会替换`prodUrl`
path: "https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"
}
]
});

View File

@@ -12,10 +12,12 @@ const include = [
"axios",
"pinia",
"swiper",
"lodash",
"echarts",
"intro.js",
"vue-i18n",
"js-cookie",
"lodash-es",
"cropperjs",
"jsbarcode",
"sortablejs",
@@ -25,6 +27,8 @@ const include = [
"vue3-danmaku",
"v-contextmenu",
"vue-pdf-embed",
"lodash-unified",
"@ctrl/tinycolor",
"china-area-data",
"vue-json-pretty",
"@logicflow/core",

View File

@@ -1,6 +1,6 @@
{
"name": "vue-pure-admin",
"version": "3.9.5",
"version": "3.9.4",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
@@ -30,12 +30,13 @@
],
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@ctrl/tinycolor": "^3.4.1",
"@howdyjs/mouse-menu": "^2.0.5",
"@logicflow/core": "^1.1.30",
"@logicflow/extension": "^1.1.30",
"@pureadmin/descriptions": "^1.1.0",
"@pureadmin/table": "^1.9.0",
"@pureadmin/utils": "^1.8.5",
"@pureadmin/table": "^1.8.3",
"@pureadmin/utils": "^1.7.4",
"@vueuse/core": "^9.6.0",
"@vueuse/motion": "2.0.0-beta.12",
"@wangeditor/editor": "^5.1.21",
@@ -52,6 +53,9 @@
"intro.js": "^6.0.0",
"js-cookie": "^3.0.1",
"jsbarcode": "^3.11.5",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.2",
"md-editor-v3": "^2.5.0",
"mitt": "^3.0.0",
"mockjs": "^1.1.0",
@@ -89,6 +93,8 @@
"@types/element-resize-detector": "1.1.3",
"@types/intro.js": "^5.1.0",
"@types/js-cookie": "^3.0.1",
"@types/lodash": "^4.14.180",
"@types/lodash-es": "^4.17.6",
"@types/mockjs": "^1.0.7",
"@types/node": "^18.11.9",
"@types/nprogress": "0.2.0",

971
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
{
"Version": "3.9.5",
"Version": "3.9.4",
"Title": "PureAdmin",
"FixedHeader": true,
"HiddenSideBar": false,

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { cloneDeep } from "@pureadmin/utils";
import { cloneDeep } from "lodash-unified";
import { IconJson } from "@/components/ReIcon/data";
import { ref, computed, CSSProperties, toRef, watch } from "vue";
type ParameterCSSProperties = (item?: string) => CSSProperties | undefined;

View File

@@ -8,9 +8,10 @@ import {
defineComponent
} from "vue";
import "./index.scss";
import { cloneDeep } from "lodash-unified";
import { isString } from "@pureadmin/utils";
import { propTypes } from "@/utils/propTypes";
import { IconifyIconOffline } from "../../ReIcon";
import { isString, cloneDeep } from "@pureadmin/utils";
import QRCode, { QRCodeRenderersOptions } from "qrcode";
interface QrcodeLogo {
@@ -96,7 +97,7 @@ export default defineComponent({
width: props.width,
...options
});
(unref(wrapRef) as any).src = url;
(unref(wrapRef) as HTMLImageElement).src = url;
emit("done", url);
loading.value = false;
}

View File

@@ -5,7 +5,7 @@ export const auth: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
const { value } = binding;
if (value) {
!hasAuth(value) && el.parentNode?.removeChild(el);
!hasAuth(value) && el.parentNode.removeChild(el);
} else {
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
}

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
import { cloneDeep } from "@pureadmin/utils";
import { cloneDeep } from "lodash-unified";
import SearchResult from "./SearchResult.vue";
import SearchFooter from "./SearchFooter.vue";
import { deleteChildren } from "@/utils/tree";

View File

@@ -132,8 +132,8 @@ const multiTagsCacheChange = () => {
/** 清空缓存并返回登录页 */
function onReset() {
removeToken();
storageLocal().clear();
storageSession().clear();
storageLocal.clear();
storageSession.clear();
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
useAppStoreHook().setLayout(Layout);
setEpThemeColor(EpThemeColor);

View File

@@ -12,8 +12,7 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
const route = useRoute();
const showLogo = ref(
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showLogo ??
true
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showLogo ?? true
);
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =

View File

@@ -4,7 +4,7 @@ import { emitter } from "@/utils/mitt";
import { RouteConfigs } from "../../types";
import { useTags } from "../../hooks/useTag";
import { routerArrays } from "@/layout/types";
import { isEqual, isAllEmpty } from "@pureadmin/utils";
import { isEqual, isEmpty } from "lodash-unified";
import { useSettingStoreHook } from "@/store/modules/settings";
import { ref, watch, unref, nextTick, onBeforeMount } from "vue";
import { handleAliveRoute, delAliveRoutes } from "@/router/utils";
@@ -349,7 +349,7 @@ function showMenuModel(
const allRoute = multiTags.value;
const routeLength = multiTags.value.length;
let currentIndex = -1;
if (isAllEmpty(query)) {
if (isEmpty(query)) {
currentIndex = allRoute.findIndex(v => v.path === currentPath);
} else {
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));

View File

@@ -1,7 +1,9 @@
import { ref } from "vue";
import { getConfig } from "@/config";
import { find } from "lodash-unified";
import { useLayout } from "./useLayout";
import { themeColorsType } from "../types";
import { TinyColor } from "@ctrl/tinycolor";
import { useGlobal } from "@pureadmin/utils";
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import {
@@ -54,27 +56,35 @@ export function useDataThemeChange() {
if (theme === "default" || theme === "light") {
setEpThemeColor(getConfig().EpThemeColor);
} else {
const colors = themeColors.value.find(v => v.themeColor === theme);
const colors = find(themeColors.value, { themeColor: theme });
setEpThemeColor(colors.color);
}
}
function setPropertyPrimary(mode: string, i: number, color: string) {
document.documentElement.style.setProperty(
`--el-color-primary-${mode}-${i}`,
dataTheme.value ? darken(color, i / 10) : lighten(color, i / 10)
);
}
/**
* @description 自动计算hover和active颜色
* @see {@link https://element-plus.org/zh-CN/component/button.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%9C%E8%89%B2}
*/
const shadeBgColor = (color: string): string => {
return new TinyColor(color).shade(10).toString();
};
/** 设置 `element-plus` 主题色 */
const setEpThemeColor = (color: string) => {
useEpThemeStoreHook().setEpThemeColor(color);
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
document.documentElement.style.setProperty("--el-color-primary", color);
for (let i = 1; i <= 2; i++) {
setPropertyPrimary("dark", i, color);
}
for (let i = 1; i <= 9; i++) {
setPropertyPrimary("light", i, color);
document.documentElement.style.setProperty(
`--el-color-primary-light-${i}`,
lighten(color, i / 10)
);
}
for (let i = 1; i <= 2; i++) {
document.documentElement.style.setProperty(
`--el-color-primary-dark-${i}`,
darken(color, i / 10)
);
}
};

View File

@@ -41,13 +41,13 @@ export function useTags() {
/** 显示模式,默认灵动模式 */
const showModel = ref(
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showModel ||
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
/** 是否隐藏标签页,默认显示 */
const showTags =
ref(
storageLocal().getItem<StorageConfigs>("responsive-configure").hideTabs
storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
) ?? ref("false");
const multiTags: any = computed(() => {
return useMultiTagsStoreHook().multiTags;
@@ -195,11 +195,11 @@ export function useTags() {
onMounted(() => {
if (!showModel.value) {
const configure = storageLocal().getItem<StorageConfigs>(
const configure = storageLocal.getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal().setItem("responsive-configure", configure);
storageLocal.setItem("responsive-configure", configure);
}
});

View File

@@ -63,7 +63,7 @@ export const $t = (key: string) => key;
export const i18n: I18n = createI18n({
legacy: false,
locale:
storageLocal().getItem<StorageConfigs>("responsive-locale")?.locale ?? "zh",
storageLocal.getItem<StorageConfigs>("responsive-locale")?.locale ?? "zh",
fallbackLocale: "en",
messages: localesConfigs
});

View File

@@ -1,6 +1,7 @@
import "@/utils/sso";
import { getConfig } from "@/config";
import NProgress from "@/utils/progress";
import { findIndex } from "lodash-unified";
import { transformI18n } from "@/plugins/i18n";
import { sessionKey, type DataInfo } from "@/utils/auth";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
@@ -105,7 +106,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
handleAliveRoute(newMatched);
}
}
const userInfo = storageSession().getItem<DataInfo<number>>(sessionKey);
const userInfo = storageSession.getItem<DataInfo<number>>(sessionKey);
NProgress.start();
const externalLink = isUrl(to?.name as string);
if (!externalLink) {
@@ -143,10 +144,14 @@ router.beforeEach((to: toRouteType, _from, next) => {
initRouter().then((router: Router) => {
if (!useMultiTagsStoreHook().getMultiTagsCache) {
const { path } = to;
const route = findRouteByPath(
path,
router.options.routes[0].children
);
const index = findIndex(remainingRouter, v => {
return v.path == path;
});
const routes: any =
index === -1
? router.options.routes[0].children
: router.options.routes;
const route = findRouteByPath(path, routes);
// query、params模式路由传参数的标签页不在此处处理
if (route && route.meta?.title) {
useMultiTagsStoreHook().handleTags("push", {

View File

@@ -6,7 +6,6 @@ export default {
redirect: "/error/403",
meta: {
icon: "informationLine",
// showLink: false,
title: $t("menus.hsabnormal"),
rank: error
},

View File

@@ -13,14 +13,12 @@ import { useTimeoutFn } from "@vueuse/core";
import { RouteConfigs } from "@/layout/types";
import {
isString,
cloneDeep,
isAllEmpty,
intersection,
storageSession,
isIncludeAllChildren
} from "@pureadmin/utils";
import { getConfig } from "@/config";
import { buildHierarchyTree } from "@/utils/tree";
import { cloneDeep, intersection } from "lodash-unified";
import { sessionKey, type DataInfo } from "@/utils/auth";
import { usePermissionStoreHook } from "@/store/modules/permission";
const IFrame = () => import("@/layout/frameView.vue");
@@ -30,25 +28,19 @@ const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
// 动态路由
import { getAsyncRoutes } from "@/api/routes";
function handRank(routeInfo: any) {
const { name, path, parentId, meta } = routeInfo;
return isAllEmpty(parentId)
? isAllEmpty(meta?.rank) ||
(meta?.rank === 0 && name !== "Home" && path !== "/")
? true
: false
: false;
}
/** 按照路由中meta下的rank等级升序来排序路由 */
function ascending(arr: any[]) {
arr.forEach((v, index) => {
// 当rank不存在时根据顺序自动创建首页路由永远在第一位
if (handRank(v)) v.meta.rank = index + 2;
arr.forEach(v => {
if (v?.meta?.rank === null) v.meta.rank = undefined;
if (v?.meta?.rank === 0) {
if (v.name !== "Home" && v.path !== "/") {
console.warn("rank only the home page can be 0");
}
}
});
return arr.sort(
(a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
return a?.meta.rank - b?.meta.rank;
return a?.meta?.rank - b?.meta?.rank;
}
);
}
@@ -85,7 +77,7 @@ function isOneOfArray(a: Array<string>, b: Array<string>) {
/** 从sessionStorage里取出当前登陆用户的角色roles过滤无权限的菜单 */
function filterNoPermissionTree(data: RouteComponent[]) {
const currentRoles =
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
const newTree = cloneDeep(data).filter((v: any) =>
isOneOfArray(v.meta?.roles, currentRoles)
);
@@ -197,7 +189,7 @@ function initRouter() {
if (getConfig()?.CachingAsyncRoutes) {
// 开启动态路由缓存本地sessionStorage
const key = "async-routes";
const asyncRouteList = storageSession().getItem(key) as any;
const asyncRouteList = storageSession.getItem(key) as any;
if (asyncRouteList && asyncRouteList?.length > 0) {
return new Promise(resolve => {
handleAsyncRoutes(asyncRouteList);
@@ -207,7 +199,7 @@ function initRouter() {
return new Promise(resolve => {
getAsyncRoutes().then(({ data }) => {
handleAsyncRoutes(cloneDeep(data));
storageSession().setItem(key, data);
storageSession.setItem(key, data);
resolve(router);
});
});
@@ -260,7 +252,7 @@ function formatTwoStageRoutes(routesList: RouteRecordRaw[]) {
children: []
});
} else {
newRoutesList[0]?.children.push({ ...v });
newRoutesList[0].children.push({ ...v });
}
});
return newRoutesList;
@@ -356,7 +348,6 @@ function hasAuth(value: string | Array<string>): boolean {
if (!value) return false;
/** 从当前路由的`meta`字段里获取按钮级别的所有自定义`code`值 */
const metaAuths = getAuths();
if (!metaAuths) return false;
const isAuths = isString(value)
? metaAuths.includes(value)
: isIncludeAllChildren(value, metaAuths);

View File

@@ -9,14 +9,14 @@ export const useAppStore = defineStore({
state: (): appType => ({
sidebar: {
opened:
storageLocal().getItem<StorageConfigs>("responsive-layout")
storageLocal.getItem<StorageConfigs>("responsive-layout")
?.sidebarStatus ?? getConfig().SidebarStatus,
withoutAnimation: false,
isClickCollapse: false
},
// 这里的layout用于监听容器拖拉后恢复对应的导航模式
layout:
storageLocal().getItem<StorageConfigs>("responsive-layout")?.layout ??
storageLocal.getItem<StorageConfigs>("responsive-layout")?.layout ??
getConfig().Layout,
device: deviceDetection() ? "mobile" : "desktop",
// 作用于 src/views/components/draggable/index.vue 页面,当离开页面并不会销毁 new Swap()sortablejs 官网也没有提供任何销毁的 api
@@ -32,8 +32,7 @@ export const useAppStore = defineStore({
},
actions: {
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
const layout =
storageLocal().getItem<StorageConfigs>("responsive-layout");
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
if (opened && resize) {
this.sidebar.withoutAnimation = true;
this.sidebar.opened = true;
@@ -48,7 +47,7 @@ export const useAppStore = defineStore({
this.sidebar.isClickCollapse = !this.sidebar.opened;
layout.sidebarStatus = this.sidebar.opened;
}
storageLocal().setItem("responsive-layout", layout);
storageLocal.setItem("responsive-layout", layout);
},
async toggleSideBar(opened?: boolean, resize?: string) {
await this.TOGGLE_SIDEBAR(opened, resize);

View File

@@ -7,10 +7,10 @@ export const useEpThemeStore = defineStore({
id: "pure-epTheme",
state: () => ({
epThemeColor:
storageLocal().getItem<StorageConfigs>("responsive-layout")
?.epThemeColor ?? getConfig().EpThemeColor,
storageLocal.getItem<StorageConfigs>("responsive-layout")?.epThemeColor ??
getConfig().EpThemeColor,
epTheme:
storageLocal().getItem<StorageConfigs>("responsive-layout")?.theme ??
storageLocal.getItem<StorageConfigs>("responsive-layout")?.theme ??
getConfig().Theme
}),
getters: {
@@ -30,13 +30,12 @@ export const useEpThemeStore = defineStore({
},
actions: {
setEpThemeColor(newColor: string): void {
const layout =
storageLocal().getItem<StorageConfigs>("responsive-layout");
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
this.epTheme = layout?.theme;
this.epThemeColor = newColor;
if (!layout) return;
layout.epThemeColor = newColor;
storageLocal().setItem("responsive-layout", layout);
storageLocal.setItem("responsive-layout", layout);
}
}
});

View File

@@ -9,13 +9,12 @@ export const useMultiTagsStore = defineStore({
id: "pure-multiTags",
state: () => ({
// 存储标签页信息(路由信息)
multiTags: storageLocal().getItem<StorageConfigs>("responsive-configure")
multiTags: storageLocal.getItem<StorageConfigs>("responsive-configure")
?.multiTagsCache
? storageLocal().getItem<StorageConfigs>("responsive-tags")
? storageLocal.getItem<StorageConfigs>("responsive-tags")
: [...routerArrays],
multiTagsCache: storageLocal().getItem<StorageConfigs>(
"responsive-configure"
)?.multiTagsCache
multiTagsCache: storageLocal.getItem<StorageConfigs>("responsive-configure")
?.multiTagsCache
}),
getters: {
getMultiTagsCache() {
@@ -26,14 +25,14 @@ export const useMultiTagsStore = defineStore({
multiTagsCacheChange(multiTagsCache: boolean) {
this.multiTagsCache = multiTagsCache;
if (multiTagsCache) {
storageLocal().setItem("responsive-tags", this.multiTags);
storageLocal.setItem("responsive-tags", this.multiTags);
} else {
storageLocal().removeItem("responsive-tags");
storageLocal.removeItem("responsive-tags");
}
},
tagsCache(multiTags) {
this.getMultiTagsCache &&
storageLocal().setItem("responsive-tags", multiTags);
storageLocal.setItem("responsive-tags", multiTags);
},
handleTags<T>(
mode: string,

View File

@@ -14,9 +14,9 @@ export const useUserStore = defineStore({
state: (): userType => ({
// 用户名
username:
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "",
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "",
// 页面级别权限
roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
roles: storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
// 前端生成的验证码(按实际需求替换)
verifyCode: "",
// 判断登录页面显示哪个组件0登录默认、1手机登录、2二维码登录、3注册、4忘记密码

View File

@@ -1,4 +1,4 @@
@use "element-plus/theme-chalk/src/dark/css-vars.scss" as *;
@import "element-plus/theme-chalk/src/dark/css-vars.scss";
/* 暗黑模式适配 */
html.dark {

View File

@@ -23,7 +23,7 @@ export function getToken(): DataInfo<number> {
// 此处与`TokenKey`相同,此写法解决初始化时`Cookies`中不存在`TokenKey`报错
return Cookies.get(TokenKey)
? JSON.parse(Cookies.get(TokenKey))
: storageSession().getItem(sessionKey);
: storageSession.getItem(sessionKey);
}
/**
@@ -47,7 +47,7 @@ export function setToken(data: DataInfo<Date>) {
function setSessionKey(username: string, roles: Array<string>) {
useUserStoreHook().SET_USERNAME(username);
useUserStoreHook().SET_ROLES(roles);
storageSession().setItem(sessionKey, {
storageSession.setItem(sessionKey, {
refreshToken,
expires,
username,
@@ -60,9 +60,9 @@ export function setToken(data: DataInfo<Date>) {
setSessionKey(username, roles);
} else {
const username =
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "";
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "";
const roles =
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
setSessionKey(username, roles);
}
}

View File

@@ -1,5 +1,5 @@
import REGION_DATA from "china-area-data";
import { cloneDeep } from "@pureadmin/utils";
import { cloneDeep } from "lodash-unified";
interface ProvinceData {
value: string;

View File

@@ -7,12 +7,8 @@ defineOptions({
</script>
<template>
<div class="w-full h-full text-center">
<h1>业务内容模块</h1>
<p>使用场景需要外嵌平台某个页面不需要展示菜单导航以及额外模块</p>
<div class="back" title="返回上一页" @click="$router.go(-1)">
<back class="w-[80px] h-[80px]" />
</div>
<div class="back" title="返回上一页" @click="$router.go(-1)">
<back class="w-[80px] h-[80px]" />
</div>
</template>

View File

@@ -16,7 +16,7 @@ export const list = [
{
key: "page",
content: rendContent("page"),
title: "分页、加载动画、动态列",
title: "分页、加载动画",
component: Page
},
{

View File

@@ -6,25 +6,19 @@ import type { PaginationProps, LoadingConfig, Align } from "@pureadmin/table";
export function useColumns() {
const dataList = ref([]);
const loading = ref(true);
const hideVal = ref("nohide");
const tableSize = ref("default");
const paginationSmall = ref(false);
const paginationAlign = ref("right");
const columns: TableColumnList = [
{
label: "日期",
prop: "date",
hide: () => (hideVal.value === "hideDate" ? true : false)
prop: "date"
},
{
label: "姓名",
prop: "name",
hide: () => (hideVal.value === "hideName" ? true : false)
prop: "name"
},
{
label: "地址",
prop: "address",
hide: () => (hideVal.value === "hideAddress" ? true : false)
prop: "address"
}
];
@@ -35,8 +29,7 @@ export function useColumns() {
pageSizes: [10, 15, 20],
total: 0,
align: "right",
background: true,
small: false
background: true
});
/** 加载动画配置 */
@@ -57,10 +50,6 @@ export function useColumns() {
// background: rgba()
});
function onChange(val) {
pagination.small = val;
}
function onSizeChange(val) {
console.log("onSizeChange", val);
}
@@ -93,13 +82,9 @@ export function useColumns() {
loading,
columns,
dataList,
hideVal,
tableSize,
pagination,
loadingConfig,
paginationAlign,
paginationSmall,
onChange,
onSizeChange,
onCurrentChange
};

View File

@@ -5,13 +5,9 @@ const {
loading,
columns,
dataList,
hideVal,
tableSize,
pagination,
loadingConfig,
paginationAlign,
paginationSmall,
onChange,
onSizeChange,
onCurrentChange
} = useColumns();
@@ -19,45 +15,22 @@ const {
<template>
<div>
<el-space class="float-right mb-4">
<p class="text-sm">动态列</p>
<el-radio-group v-model="hideVal" size="small">
<el-radio-button label="nohide">不隐藏</el-radio-button>
<el-radio-button label="hideDate">隐藏日期</el-radio-button>
<el-radio-button label="hideName">隐藏姓名</el-radio-button>
<el-radio-button label="hideAddress">隐藏地址</el-radio-button>
</el-radio-group>
<el-divider direction="vertical" />
<p class="text-sm">表格大小</p>
<el-radio-group v-model="tableSize" size="small">
<el-radio-button label="large">large</el-radio-button>
<el-radio-button label="default">default</el-radio-button>
<el-radio-button label="small">small</el-radio-button>
</el-radio-group>
<el-divider direction="vertical" />
<p class="text-sm">分页大小</p>
<el-radio-group v-model="paginationSmall" size="small" @change="onChange">
<el-radio-button :label="false">no small</el-radio-button>
<el-radio-button :label="true">small</el-radio-button>
</el-radio-group>
<el-divider direction="vertical" />
<p class="text-sm">分页的对齐方式</p>
<el-radio-group v-model="paginationAlign" size="small">
<el-space class="float-right mb-2">
<p>分页的对齐方式</p>
<el-radio-group v-model="paginationAlign">
<el-radio-button label="right">right</el-radio-button>
<el-radio-button label="center">center</el-radio-button>
<el-radio-button label="left">left</el-radio-button>
</el-radio-group>
</el-space>
<pure-table
border
row-key="id"
alignWhole="center"
showOverflowTooltip
:size="tableSize"
:loading="loading"
:loading-config="loadingConfig"
:height="tableSize === 'small' ? 352 : 440"
:height="440"
:data="
dataList.slice(
(pagination.currentPage - 1) * pagination.pageSize,

View File

@@ -48,7 +48,7 @@ function onCloseTags() {
<template>
<el-card>
<template #header>
<div>标签页复用超出限制自动关闭</div>
<div>标签页复用超出限制自动关闭使用场景: 动态路由</div>
</template>
<div class="flex flex-wrap items-center">
<p>query传参模式</p>