Skip to content

Commit af0cc7b

Browse files
committed
应用系统体系架构 作业11 MongoDB和Neo4j
1 parent 4baf65f commit af0cc7b

File tree

8 files changed

+220
-7
lines changed

8 files changed

+220
-7
lines changed

package-lock.json

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@testing-library/react": "^12.1.3",
1717
"@testing-library/user-event": "^13.5.0",
1818
"antd": "^4.18.9",
19+
"antd-img-crop": "^4.5.2",
1920
"base-64": "^1.0.0",
2021
"config": "^3.3.7",
2122
"crypto-js": "^4.1.1",

src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import BookSellnum from "./view/admin/Statistics/BookSellnum";
2828
import myStatistics from "./view/iEbook/myStatistics";
2929
import RulesPage from "./view/login/LoginPageRules";
3030
import noItemPage from "./view/Result/noItemPage";
31+
import myAccount from "./view/iEbook/myAccount";
3132

3233
class App extends React.Component{
3334
constructor(props) {
@@ -59,6 +60,7 @@ class App extends React.Component{
5960
{/* --------- 下面的部分是私有路由 带有权限鉴定 --------------- */}
6061
<PrivateRoute exact path="/eBook/makeOrder/directBuy" component={SingleOrderComfirm}/>
6162
<PrivateRoute exact path="/eBook/makeOrder/shopCart" component={shopCartOrderComfirm}/>
63+
<PrivateRoute exact path="/eBook/myAccount/" component={myAccount}/>
6264
<PrivateRoute exact path="/eBook/myCart/" component={myCart}/>
6365
<PrivateRoute exact path="/eBook/myOrder/" component={myOrder}/>
6466
<PrivateRoute exact path="/eBook/myStatistics/" component={myStatistics}/>

src/components/SearchPanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ class SearchPanel extends React.Component{
6363
<Input.Group compact>
6464
<Select style={{ width: '15%',textAlign:'center'} } defaultValue="0"
6565
onChange={(e) => this.selectChange(e)}>
66+
<Option value="0" style={{ textAlign: 'center'}}>全局搜索</Option>*/}
6667
<Option value="1" style={{ textAlign: 'center'}}>书籍</Option>
6768
<Option value="2" style={{ textAlign: 'center'}}>出版社</Option>*/}
6869
<Option value="3" style={{ textAlign: 'center'}}>作者</Option>*/}
69-
<Option value="0" style={{ textAlign: 'center'}}>全局搜索</Option>*/}
7070
<Option value="4" style={{ textAlign: 'center'}}>简介全文搜索</Option>*/}
71+
<Option value="5" style={{ textAlign: 'center'}}>Tag搜索</Option>*/}
7172
</Select>
7273

7374
<Search
@@ -87,4 +88,4 @@ class SearchPanel extends React.Component{
8788

8889

8990

90-
export default SearchPanel;
91+
export default SearchPanel;

src/components/TopBar/TopBar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TopBar extends React.Component {
1616
current: 'mail',
1717
userPermissionLevel: 3,
1818
};
19+
1920
}
2021

2122
// 暂定 userPermissionLevel 0 超级管理员,1 商店用户 2 普通用户 3 未登录用户

src/components/TopBar/userTopBar.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
import React from "react";
22
import {Avatar, Badge, Menu} from "antd";
33
import {Link} from "react-router-dom";
4-
import {AppstoreOutlined, SoundOutlined, UserOutlined} from "@ant-design/icons";
4+
import {AppstoreOutlined, SoundOutlined} from "@ant-design/icons";
55
import LoginPassport from "../Login/LoginPassport";
66
import loginPassport from "../Login/LoginPassport";
7+
import {userInfoRequest} from "../../service/userService";
78

89
const { SubMenu } = Menu;
910

1011
class userTopBar extends React.Component{
12+
constructor() {
13+
super();
14+
this.state = {
15+
iconBase64 : ""
16+
};
17+
userInfoRequest((resp)=>{
18+
console.log(resp);
19+
this.setState({iconBase64: resp.data.userIcon.iconBase64})
20+
});
21+
}
1122

1223
musicPlay(musicId){
1324
let tmp = document.getElementById("BackgroundMusic");
@@ -40,6 +51,7 @@ class userTopBar extends React.Component{
4051

4152
<SubMenu key="iEBook" icon={<AppstoreOutlined/>} title="iEBook">
4253
<Menu.ItemGroup>
54+
<Menu.Item key="myAccount" ><Link to={{pathname:'/eBook/myAccount'}}>我的账户</Link></Menu.Item>
4355
<Menu.Item key="myCart" ><Link to={{pathname:'/eBook/myCart'}}>我的购物车</Link></Menu.Item>
4456
<Menu.Item key="myOrder" ><Link to={{pathname:'/eBook/myOrder'}}>我的订单</Link></Menu.Item>
4557
<Menu.Item key="myComment" >
@@ -69,7 +81,12 @@ class userTopBar extends React.Component{
6981
<SubMenu
7082
id="MainPageLoginDiv"
7183
title={"Hello! "+loginPassport.getNickName()}
72-
icon={<Badge count={0} size="small"><Avatar size="middle" icon={<UserOutlined/>}/></Badge>}
84+
icon={
85+
<Badge count={0} size="small">
86+
{/*<Avatar size="middle" icon={<UserOutlined/>}/>*/}
87+
<Avatar size="middle" src={this.state.iconBase64}/>
88+
</Badge>
89+
}
7390
>
7491
<Menu.Item key="setting:22">我的消息</Menu.Item>
7592
<Menu.Item key="setting:23" onClick={(e) => this.logout()}>退出登录</Menu.Item>
@@ -87,4 +104,4 @@ export default userTopBar;
87104
{/* <Menu.Item key="personalInfo">个人资料</Menu.Item>*/}
88105
{/* <Menu.Item key="PayMethod">支付方式</Menu.Item>*/}
89106
{/* </Menu.ItemGroup>*/}
90-
{/*</SubMenu>*/}
107+
{/*</SubMenu>*/}

src/css/mainPage.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
width: 98vw;
8484
height: fit-content;
8585
left: 0.5vw;
86-
opacity: 0.75;
86+
opacity: 0.95;
8787
z-index: 10;
8888

8989
}
@@ -554,4 +554,4 @@
554554
/* background-color: #ff91c4;*/
555555
/* font-weight: bold;*/
556556
/* color: white;*/
557-
/*}*/
557+
/*}*/

src/view/iEbook/myAccount.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import React from "react";
2+
import TopBar from "../../components/TopBar/TopBar";
3+
import LogoEBook from "../../asset/background/eBooklogo.svg";
4+
import {Button, Checkbox, Col, Form, Image, Input, Row, Tabs, Upload} from "antd";
5+
import {InboxOutlined, ShoppingCartOutlined, UploadOutlined, UserOutlined} from "@ant-design/icons";
6+
import OrderPayTable from "../../components/Table/orderPayTable";
7+
import TabPane from "@ant-design/pro-card/es/components/TabPane";
8+
9+
import ImgCrop from 'antd-img-crop';
10+
import {userInfoRequest} from "../../service/userService";
11+
12+
13+
class MyAccount extends React.Component{
14+
constructor() {
15+
super();
16+
17+
this.state = {
18+
tableInfo : {
19+
avatarBase64: "",
20+
username: "",
21+
passwordOriginal: "",
22+
passwordNew: "",
23+
passwordNewConfirm: "",
24+
name: "",
25+
email: "",
26+
useraddress: "",
27+
telephone: "",
28+
}
29+
}
30+
userInfoRequest((resp)=>{
31+
console.log(resp);
32+
let tmp = this.state.tableInfo;
33+
tmp.avatarBase64 = resp.data.userIcon.iconBase64;
34+
tmp.username = resp.data.username;
35+
tmp.telephone = resp.data.telephone;
36+
tmp.email = resp.data.email;
37+
this.setState({tableInfo: tmp})
38+
});
39+
}
40+
41+
42+
render() {
43+
44+
return (
45+
<div className="eBookPageContainer">
46+
<TopBar/>
47+
<div className="MainContentsCard_compact">
48+
<div className="PayComfirm_logoArea">
49+
<img src={LogoEBook} className="PayComfirm_logo" alt={"logo"}/>
50+
</div>
51+
52+
<Tabs defaultActiveKey="1">
53+
<TabPane tab={<><UserOutlined/>我的账户信息</>} key="1">
54+
55+
<Form>
56+
<Form.Item label="原始头像">
57+
<Image src={this.state.tableInfo.avatarBase64} width={100} preview={false}/>
58+
</Form.Item>
59+
<Form.Item label="更换头像">
60+
<ImgCrop rotate>
61+
<Upload
62+
name="avatar"
63+
listType="picture-card"
64+
className="avatar-uploader"
65+
showUploadList={false}
66+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
67+
// beforeUpload={beforeUpload}
68+
// onChange={handleChange}
69+
>{'+ Upload'}
70+
</Upload>
71+
</ImgCrop>
72+
</Form.Item>
73+
<Form.Item label="用户名">
74+
{this.state.tableInfo.username}
75+
</Form.Item>
76+
<Form.Item label="电话号码">
77+
{this.state.tableInfo.telephone}
78+
</Form.Item>
79+
<Form.Item label="电子邮件">
80+
{this.state.tableInfo.email}
81+
</Form.Item>
82+
83+
</Form>
84+
85+
</TabPane>
86+
</Tabs>
87+
</div>
88+
<div className="clearOnly_compact"></div>
89+
<div className="Pagefooter">
90+
<p>CopyRight © 2022 AllRights Reserved.ALL Developed By ZhangZiqian.</p>
91+
</div>
92+
</div>
93+
94+
);
95+
96+
}
97+
}
98+
99+
export default MyAccount;

0 commit comments

Comments
 (0)