Browse Source

主题设置

release_0.0.2
deartibers 3 years ago
parent
commit
769ff49451
  1. 2
      code/VideoAccess-VCMP/web/client/src/index.less
  2. 19
      code/VideoAccess-VCMP/web/client/src/layout/components/sider/index.jsx
  3. 2
      code/VideoAccess-VCMP/web/package.json
  4. 8
      code/VideoAccess-VCMP/web/webpack.config.js

2
code/VideoAccess-VCMP/web/client/src/index.less

@ -1,5 +1,5 @@
// webpack (vite 用 alias 兼容了) // webpack (vite 用 alias 兼容了)
@import '~@douyinfe/semi-ui/dist/css/semi.min.css'; // @import '~@douyinfe/semi-ui/dist/css/semi.min.css';
@import '~perfect-scrollbar/css/perfect-scrollbar.css'; @import '~perfect-scrollbar/css/perfect-scrollbar.css';
@import '~nprogress/nprogress.css'; @import '~nprogress/nprogress.css';

19
code/VideoAccess-VCMP/web/client/src/layout/components/sider/index.jsx

@ -3,6 +3,7 @@ import PerfectScrollbar from 'perfect-scrollbar';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Nav } from '@douyinfe/semi-ui'; import { Nav } from '@douyinfe/semi-ui';
import { push } from 'react-router-redux'; import { push } from 'react-router-redux';
import { useLocation } from 'react-router';
let scrollbar = null let scrollbar = null
const homePath = '/equipmentWarehouse/nvr' const homePath = '/equipmentWarehouse/nvr'
@ -45,7 +46,6 @@ const Sider = props => {
} }
} }
} }
console.log(nextItems)
setItems(nextItems) setItems(nextItems)
const { selectedKeys, openKeys } = initKeys( const { selectedKeys, openKeys } = initKeys(
@ -74,9 +74,9 @@ const Sider = props => {
dispatch(push(homePath)) dispatch(push(homePath))
} }
}, []) }, [])
let routeSelectedKey = [useLocation().pathname.split('/')[1]]//
let routeSelectedKeys = [useLocation().pathname.split('/')[2]]//
useEffect(()=>{ useEffect(()=>{
console.log(1)
let pathname_ = pathname == '/' ? homePath : pathname let pathname_ = pathname == '/' ? homePath : pathname
const initKeys = (items, lastKeys) => { const initKeys = (items, lastKeys) => {
for (let it of items) { for (let it of items) {
@ -93,15 +93,13 @@ const Sider = props => {
} }
} }
return lastKeys return lastKeys
return {
selectedKeys: [],
openKeys: []
} }
if(routeSelectedKeys[0]){
setSelectedKeys(routeSelectedKeys)
} }
const lastSelectedKeys = localStorage.getItem('vcmp_selected_sider') else{
console.log(lastSelectedKeys) setSelectedKeys(routeSelectedKey)
if (lastSelectedKeys) {
setSelectedKeys(JSON.parse(lastSelectedKeys))
} }
const lastOpenKeys = localStorage.getItem('vcmp_open_sider') const lastOpenKeys = localStorage.getItem('vcmp_open_sider')
if (lastOpenKeys) { if (lastOpenKeys) {
@ -114,7 +112,6 @@ const Sider = props => {
scrollbar.update(); scrollbar.update();
} }
}) })
console.log(selectedKeys,openKeys)
return ( return (
<div id={'page-slider'} style={{ height: clientHeight, position: 'relative' }}> <div id={'page-slider'} style={{ height: clientHeight, position: 'relative' }}>
<Nav <Nav

2
code/VideoAccess-VCMP/web/package.json

@ -48,9 +48,11 @@
}, },
"dependencies": { "dependencies": {
"@douyinfe/semi-ui": "^2.8.0", "@douyinfe/semi-ui": "^2.8.0",
"@douyinfe/semi-webpack-plugin": "^2.13.0",
"@fs/attachment": "^1.0.0", "@fs/attachment": "^1.0.0",
"@peace/components": "0.0.35", "@peace/components": "0.0.35",
"@peace/utils": "^0.0.48", "@peace/utils": "^0.0.48",
"@semi-bot/semi-theme-fsiot": "0.0.1",
"@vitejs/plugin-react": "^1.3.1", "@vitejs/plugin-react": "^1.3.1",
"@vitejs/plugin-react-refresh": "^1.3.6", "@vitejs/plugin-react-refresh": "^1.3.6",
"args": "^5.0.1", "args": "^5.0.1",

8
code/VideoAccess-VCMP/web/webpack.config.js

@ -1,7 +1,7 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const SemiWebpackPlugin = require('@douyinfe/semi-webpack-plugin').default;
const PATHS = { const PATHS = {
app: path.join(__dirname, 'client/src'), app: path.join(__dirname, 'client/src'),
build: path.join(__dirname, 'client/build') build: path.join(__dirname, 'client/build')
@ -35,6 +35,12 @@ module.exports = {
new BundleAnalyzerPlugin({ new BundleAnalyzerPlugin({
analyzerPort: 8000, analyzerPort: 8000,
}), }),
new SemiWebpackPlugin({
theme: {
name: '@semi-bot/semi-theme-fsiot',
include: '~@semi-bot/semi-theme-fsiot/scss/local.scss'
}
}),
], ],
module: { module: {
rules: [{ rules: [{

Loading…
Cancel
Save