Skip to content
Snippets Groups Projects
Commit e1bc1d46 authored by balibabu's avatar balibabu Committed by GitHub
Browse files

feat: install prettier to format code and add react-dev-inspector to locate...

feat: install prettier to format code and add react-dev-inspector to locate code in the IDE faster (#44)

* feat: add react-dev-inspector to locate code in the IDE faster

* feat: install prettier to format code

---------

Co-authored-by: default avataryangqianjuan <1072483500@qq.com>
parent 072f9dd5
No related branches found
No related tags found
No related merge requests found
{
"search-node-modules.path": "web/node_modules"
}
\ No newline at end of file
node_modules
.umi
.umi-production
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
}
...@@ -16,7 +16,7 @@ export default defineConfig({ ...@@ -16,7 +16,7 @@ export default defineConfig({
history: { history: {
type: 'browser', type: 'browser',
}, },
plugins: ['@umijs/plugins/dist/dva'], plugins: ['@react-dev-inspector/umi4-plugin','@umijs/plugins/dist/dva',],
dva: {}, dva: {},
// proxy: { // proxy: {
// '/v1': { // '/v1': {
......
This diff is collapsed.
{ {
"private": true, "private": true,
"author": "zhaofengchao <13723060510@163.com>", "author": "zhaofengchao <13723060510@163.com>",
"scripts": { "scripts": {
"dev": "cross-env PORT=9000 umi dev", "build": "umi build",
"build": "umi build", "dev": "cross-env PORT=9000 umi dev",
"postinstall": "umi setup", "postinstall": "umi setup",
"setup": "umi setup", "setup": "umi setup",
"start": "npm run dev" "start": "npm run dev"
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^5.2.6", "@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.46", "@ant-design/pro-components": "^2.6.46",
"@ant-design/pro-layout": "^7.17.16", "@ant-design/pro-layout": "^7.17.16",
"antd": "^5.12.7", "antd": "^5.12.7",
"axios": "^1.6.3", "axios": "^1.6.3",
"classnames": "^2.5.1", "classnames": "^2.5.1",
"i18next": "^23.7.16", "i18next": "^23.7.16",
"js-base64": "^3.7.5", "js-base64": "^3.7.5",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"moment": "^2.30.1", "moment": "^2.30.1",
"react-i18next": "^14.0.0", "react-i18next": "^14.0.0",
"react-infinite-scroll-component": "^6.1.0", "react-infinite-scroll-component": "^6.1.0",
"umi": "^4.0.90", "umi": "^4.0.90",
"umi-request": "^1.4.0" "umi-request": "^1.4.0"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.202", "@react-dev-inspector/umi4-plugin": "^2.0.1",
"@types/react": "^18.0.33", "@types/lodash": "^4.14.202",
"@types/react-dom": "^18.0.11", "@types/react": "^18.0.33",
"@umijs/plugins": "^4.1.0", "@types/react-dom": "^18.0.11",
"cross-env": "^7.0.3", "@umijs/plugins": "^4.1.0",
"typescript": "^5.0.3", "cross-env": "^7.0.3",
"umi-plugin-icons": "^0.1.1" "prettier": "^3.2.4",
} "prettier-plugin-organize-imports": "^3.2.4",
} "prettier-plugin-packagejson": "^2.4.9",
"react-dev-inspector": "^2.0.1",
"typescript": "^5.0.3",
"umi-plugin-icons": "^0.1.1"
}
}
import React, { ReactNode } from "react";
import { Inspector } from "react-dev-inspector";
export function rootContainer(container: ReactNode) {
return React.createElement(Inspector, null, container);
}
.knowledge { .knowledge {
padding: 24px; padding: 24px;
} }
.container { .container {
height: 100px; height: 100px;
display: flex;
flex-direction: column;
justify-content: space-between;
.content {
display: flex; display: flex;
flex-direction: column;
justify-content: space-between; justify-content: space-between;
.content { .context {
display: flex; flex: 1;
justify-content: space-between;
.context {
flex: 1
}
} }
}
.footer { .footer {
height: 20px; height: 20px;
.text { .text {
margin-left: 10px; margin-left: 10px;
}
} }
}
} }
.card { .card {
:global { :global {
.ant-card-body { .ant-card-body {
padding: 10px; padding: 10px;
margin: 0; margin: 0;
}
margin-bottom: 10px;
} }
cursor: pointer; margin-bottom: 10px;
}
} cursor: pointer;
\ No newline at end of file }
import { Effect, Reducer, Subscription } from 'umi'
import { message } from 'antd';
import kbService from '@/services/kbService'; import kbService from '@/services/kbService';
import { Effect, Reducer, Subscription } from 'umi';
export interface knowledgeModelState { export interface knowledgeModelState {
loading: boolean; loading: boolean;
data: any[] data: any[];
} }
export interface knowledgegModelType { export interface knowledgegModelType {
namespace: 'knowledgeModel'; namespace: 'knowledgeModel';
...@@ -22,45 +21,44 @@ const Model: knowledgegModelType = { ...@@ -22,45 +21,44 @@ const Model: knowledgegModelType = {
namespace: 'knowledgeModel', namespace: 'knowledgeModel',
state: { state: {
loading: false, loading: false,
data: [] data: [],
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { setup({ dispatch, history }) {
history.listen(location => { history.listen((location) => {
console.log(location) console.log(location);
}); });
} },
}, },
effects: { effects: {
* rmKb({ payload = {}, callback }, { call, put }) { *rmKb({ payload = {}, callback }, { call, put }) {
const { data, response } = yield call(kbService.rmKb, payload); const { data, response } = yield call(kbService.rmKb, payload);
const { retcode, data: res, retmsg } = data const { retcode, data: res, retmsg } = data;
if (retcode === 0) { if (retcode === 0) {
callback && callback() callback && callback();
} }
}, },
*getList({ payload = {} }, { call, put }) { *getList({ payload = {} }, { call, put }) {
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
loading: true loading: true,
} },
}); });
const { data, response } = yield call(kbService.getList, payload); const { data, response } = yield call(kbService.getList, payload);
const { retcode, data: res, retmsg } = data const { retcode, data: res, retmsg } = data;
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
loading: false loading: false,
} },
}); });
if (retcode === 0) { if (retcode === 0) {
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
data: res data: res,
} },
}); });
} }
}, },
...@@ -69,9 +67,9 @@ const Model: knowledgegModelType = { ...@@ -69,9 +67,9 @@ const Model: knowledgegModelType = {
updateState(state, { payload }) { updateState(state, { payload }) {
return { return {
...state, ...state,
...payload ...payload,
}; };
} },
} },
}; };
export default Model; export default Model;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment