Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
achievements-system-front
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bab0cfe7
authored
Mar 03, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
14428b0a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
53 deletions
src/api/login.ts → src/api/globalApi.ts
src/api/request/index.ts
src/assets/styles/global.scss
src/main.tsx
src/views/Login/index.module.scss
src/views/Login/index.tsx
src/views/Ranking/index.tsx
src/api/
login
.ts
→
src/api/
globalApi
.ts
View file @
bab0cfe
...
@@ -2,9 +2,7 @@ import request from "@/api/request";
...
@@ -2,9 +2,7 @@ import request from "@/api/request";
// import qs from "qs";
// import qs from "qs";
const
serverUrl
=
{
const
serverUrl
=
{
login
:
"/login"
,
login
:
"/login"
,
register
:
"/register"
,
getGradeList
:
"/grade/list"
,
edit
:
"/updateUserInfo"
,
del
:
"/delUser"
,
};
};
// export const register = (params:any) => {
// export const register = (params:any) => {
...
@@ -13,15 +11,11 @@ const serverUrl = {
...
@@ -13,15 +11,11 @@ const serverUrl = {
// export const getExistsemail = (params:any) => {
// export const getExistsemail = (params:any) => {
// return request.get(serverUrl.existsemail + '?' + qs.stringify(params))
// return request.get(serverUrl.existsemail + '?' + qs.stringify(params))
// }
// }
export
const
login
=
(
params
:
UserMessage
)
=>
{
export
const
loginApi
=
(
params
:
UserMessage
)
=>
{
return
request
.
post
(
serverUrl
.
login
,
params
);
return
request
.
post
(
serverUrl
.
login
,
params
);
};
};
export
const
register
=
(
params
:
UserMessage
)
=>
{
return
request
.
post
(
serverUrl
.
register
,
params
);
export
const
getGradeListApi
=
(
params
:
any
)
=>
{
};
return
request
.
post
(
serverUrl
.
getGradeList
,
params
);
export
const
userEdit
=
(
params
:
UserMessage
)
=>
{
return
request
.
post
(
serverUrl
.
edit
,
params
);
};
export
const
userDel
=
(
params
:
{
id
:
number
})
=>
{
return
request
.
post
(
serverUrl
.
del
,
params
);
};
};
src/api/request/index.ts
View file @
bab0cfe
...
@@ -2,14 +2,13 @@ import HttpRequest from "./request";
...
@@ -2,14 +2,13 @@ import HttpRequest from "./request";
const
config
=
{
const
config
=
{
baseUrl
:
{
baseUrl
:
{
dev
:
"http://192.168.1.127:7001"
,
dev
:
"http://192.168.1.127:7001"
,
// pro: "https://config-center-backend.glsx.com.cn", //生产环境
prod
:
"http://config-center-backend.glsx.com"
,
//test环境
pro
:
"http://config-center-backend.glsx.com"
,
//test环境
},
},
};
};
const
baseUrl
=
const
baseUrl
=
process
.
env
.
NODE_ENV
===
"development"
process
.
env
.
NODE_ENV
===
"development"
?
config
.
baseUrl
.
dev
?
config
.
baseUrl
.
dev
:
config
.
baseUrl
.
pro
;
:
config
.
baseUrl
.
pro
d
;
const
axios
=
new
HttpRequest
(
baseUrl
);
const
axios
=
new
HttpRequest
(
baseUrl
);
...
...
src/assets/styles/global.scss
View file @
bab0cfe
$themeColor
:
#5261a1
;
body
{
body
{
// user-select: none;
// user-select: none;
}
}
img
{
img
{
// -webkit-user-drag: none;
// -webkit-user-drag: none;
}
}
\ No newline at end of file
\ No newline at end of file
src/main.tsx
View file @
bab0cfe
...
@@ -7,8 +7,8 @@ import { BrowserRouter } from "react-router-dom";
...
@@ -7,8 +7,8 @@ import { BrowserRouter } from "react-router-dom";
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<React.StrictMode>
<BrowserRouter>
<BrowserRouter>
<App />
<App />
</BrowserRouter>
</BrowserRouter>
</React.StrictMode>
</React.StrictMode>
)
)
src/views/Login/index.module.scss
View file @
bab0cfe
.ctnr
{
.ctnr
{
display
:
flex
;
display
:
flex
;
background
:
url('https://wx.glsx.com.cn/upload/biz/918f8b69-f055-4092-994d-5a16f10d55ff.jpeg')
center
/
cover
no-repeat
;
position
:
fixed
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
0
;
.title
{
font-size
:
24px
;
font-weight
:
600
;
font-family
:
fangsong
;
padding
:
10px
10px
20px
;
text-align
:
center
;
}
.form
{
.form
{
position
:
fixed
;
position
:
fixed
;
left
:
0
;
border-radius
:
8px
;
right
:
0
;
left
:
50%
;
top
:
0
;
transform
:
translate
(
-50%
,
200px
);
bottom
:
0
;
width
:
520px
;
width
:
520px
;
padding
:
35px
35px
15px
;
height
:
350px
;
margin
:
120px
auto
;
background-color
:
#fff
;
background-color
:
#eee
;
.btn
{
width
:
200px
;
height
:
42px
;
font-size
:
18px
;
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
src/views/Login/index.tsx
View file @
bab0cfe
import React from 'react';
import { useNavigate } from "react-router-dom";
import { useNavigate, useLocation } from "react-router-dom";
import { loginApi } from "@/api/globalApi";
import { login } from "@/api/login";
import styles from './index.module.scss'
import styles from './index.module.scss'
import { Button, Checkbox, Form, Input, message
} from 'antd';
import { Button, Checkbox, Form, Input, message } from 'antd';
const App = () => {
const App = () => {
const navigate = useNavigate();
const navigate = useNavigate();
const onFinish = (values: any) => {
const onFinish = (values: any) => {
const {username, password } = values
const { username, password } = values
const params = {username, password }
const params = { username, password }
login(params).then(({ code, data, message: msg }) => {
loginApi(params).then(({ code, data, message: msg }) => {
console.log(code)
if (code === 200) {
if (code === 200) {
window.sessionStorage.setItem("token", data && data.token);
window.sessionStorage.setItem("token", data && data.token);
window.sessionStorage.setItem(
window.sessionStorage.setItem(
"userInfo",
"userInfo",
data && data.user && JSON.stringify(data.user)
data && data.user && JSON.stringify(data.user)
);
);
navigate('/detail
')
navigate('/ranking
')
} else {
} else {
message.error(msg)
message.error(msg)
}
}
}).catch(({ message: msg }) => {
message.error(msg)
})
})
};
};
...
@@ -30,7 +32,7 @@ const App = () => {
...
@@ -30,7 +32,7 @@ const App = () => {
};
};
return (
return (
<div className={styles.ctnr}>
<div className={styles.ctnr}>
<Form
<Form
name="basic"
name="basic"
labelCol={{ span: 6 }}
labelCol={{ span: 6 }}
wrapperCol={{ span: 16 }}
wrapperCol={{ span: 16 }}
...
@@ -41,6 +43,7 @@ const App = () => {
...
@@ -41,6 +43,7 @@ const App = () => {
autoComplete="off"
autoComplete="off"
className={styles.form}
className={styles.form}
>
>
<div className={styles.title}>绩效系统</div>
<Form.Item
<Form.Item
label="员工姓名"
label="员工姓名"
name="username"
name="username"
...
@@ -57,12 +60,12 @@ const App = () => {
...
@@ -57,12 +60,12 @@ const App = () => {
<Input.Password />
<Input.Password />
</Form.Item>
</Form.Item>
<Form.Item name="remember" valuePropName="checked" wrapperCol={{span: 16 }}>
<Form.Item name="remember" valuePropName="checked" wrapperCol={{
offset: 6,
span: 16 }}>
<Checkbox>记住密码</Checkbox>
<Checkbox>记住密码</Checkbox>
</Form.Item>
</Form.Item>
<Form.Item wrapperCol={{ span: 24 }}>
<Form.Item wrapperCol={{
offset: 8,
span: 24 }}>
<Button type="primary" htmlType="submit">
<Button
className={styles.btn}
type="primary" htmlType="submit">
登录
登录
</Button>
</Button>
</Form.Item>
</Form.Item>
...
...
src/views/Ranking/index.tsx
View file @
bab0cfe
import
React, { useEffect, useRef
} from 'react';
import
{ useEffect
} from 'react';
import * as echarts from 'echarts';
import * as echarts from 'echarts';
import { echartData } from '@/views/constantData'
import { echartData } from '@/views/constantData'
import { getGradeListApi } from "@/api/globalApi";
let echartOptions = echartData
let echartOptions = echartData
function Ranking() {
function Ranking() {
let myChart: any = null;
let myChart: any = null;
const initChart = () => {
const initChart = () => {
let element:any = document.getElementById('chartDom');
let element:
any = document.getElementById('chartDom');
myChart = echarts.init(element);
myChart = echarts.init(element);
myChart.clear()
myChart.clear()
echartOptions && myChart.setOption(echartOptions);
echartOptions && myChart.setOption(echartOptions);
}
}
const getGradeList = async () => {
const gradeList = await getGradeListApi({ pageSize: 13, pageNum: 1 })
console.log(gradeList, 'gradeList')
}
getGradeList()
useEffect(() => {
useEffect(() => {
initChart()
initChart()
window.addEventListener("resize", () => {
window.addEventListener("resize", () => {
myChart && myChart.resize();
myChart && myChart.resize();
});
});
// 组件销毁前卸载监听方法
// 组件销毁前卸载监听方法
return () => {
return () => {
window.removeEventListener("resize", () => {
window.removeEventListener("resize", () => {
myChart && myChart.resize();
myChart && myChart.resize();
});
});
}
}
}, [])
}, [])
return (
return (
<div id='chartDom' style={{ width: '80%', margin: '0 auto', height: '600px' }}></div>
<div id='chartDom' style={{ width: '80%', margin: '0 auto', height: '600px' }}></div>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment