Skip to content

Commit

Permalink
v0.3.1 (#189)
Browse files Browse the repository at this point in the history
v0.3.1

Co-authored-by: Jianghao Lin <[email protected]>
Co-authored-by: Kang Huquan <[email protected]>
Co-authored-by: Ataraxia <[email protected]>
  • Loading branch information
4 people authored Sep 6, 2019
2 parents 0587e06 + 7eaef79 commit bcb207e
Show file tree
Hide file tree
Showing 123 changed files with 3,182 additions and 13,078 deletions.
2 changes: 1 addition & 1 deletion admin-frontend/src/app/infodetail/infodetail.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@

#content{
width:100%;
height:500px;
height:700px;
}
63 changes: 63 additions & 0 deletions app-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
},
"dependencies": {
"axios": "^0.19.0",
"jwt-decode": "^2.2.0",
"react": "16.8.6",
"react-native": "0.60.0",
"react-native-elements": "^1.1.0",
"react-native-fetch-blob": "^0.10.8",
"react-native-gesture-handler": "^1.3.0",
"react-native-gifted-chat": "^0.9.11",
"react-native-image-crop-picker": "^0.25.0",
"react-native-lightbox": "^0.8.0",
"react-native-looped-carousel": "^0.1.13",
"react-native-modal-dropdown": "^0.6.2",
"react-native-textarea": "^1.0.3",
"react-native-vector-icons": "^6.6.0",
"react-native-video": "^4.4.4",
"react-native-webview": "^5.12.1",
"react-navigation": "^3.11.0",
"react-redux": "^7.1.0",
Expand Down
17 changes: 17 additions & 0 deletions app-frontend/src/Components/MyAvatar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Avatar} from "react-native-elements";
import React, {Component} from 'react';
import Config from "../Config";

export default class MyAvatar extends Component {
render() {
if(this.props.avatarID === 'to_be_changed') {
return (
<Avatar rounded size='large' source={require('../assets/images/NotLogin.jpg')}/>
)
} else {
return (
<Avatar rounded size='large' source={{uri: (Config.fetchPrefix + 'file/' + this.props.avatarID)}}/>
)
}
}
}
16 changes: 15 additions & 1 deletion app-frontend/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ let Config = {
userInfo: {
userID: -1,
userName: '',
avatarID: '',
avatarID: 'to_be_changed',
telephone: '',
studentID: '',
studentName: '',
},
isReleaseRender: false,
isContactRender: false,
};

export const isLogin = () => {
return Config.userInfo.userID !== -1;
};

export const isReleaseRendered = () => {
return Config.isReleaseRender;
};

export const isContactRendered = () => {
return Config.isContactRender;
};

export default Config;
45 changes: 27 additions & 18 deletions app-frontend/src/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,39 @@ import BuyInfoScreen from "../Views/BuyInfo/BuyInfo";
import SellInfoScreen from "../Views/SellInfo/SellInfo";
import SearchScreen from "../Views/Search/Search";
import LoginScreen from "../Views/Login/Login";

class Test extends Component {
render() {
return (
<View >
<Text>
test page!
</Text>
</View>
)
}
}
import TestPage from '../Views/TestPage/TestPage';
import GoodInfoScreen from '../Views/GoodInfo/GoodInfo';
import UserInfoForOthersScreen from "../Views/UserInfoForOthers/UserInfoForOthors";
import SellInfoForOthersScreen from "../Views/SellInfoForOthers/SellInfoForOthers";
import BuyInfoForOthersScreen from "../Views/BuyInfoForOthers/BuyInfoForOthers";
import MessageScreen from '../Views/Message/Message';
import Config from "../Config";
import {isLogin, isContactRendered, isReleaseRendered} from "../Config";

const HomeStack = createStackNavigator({
Home: { screen: HomeScreen },
BuyInfo: { screen: BuyInfoScreen },
SellInfo: { screen: SellInfoScreen },
Search: { screen: SearchScreen },
GoodInfo: { screen: GoodInfoScreen },
UserInfoForOthers: { screen: UserInfoForOthersScreen},
SellInfoForOthers: { screen: SellInfoForOthersScreen },
BuyInfoForOthers: { screen: BuyInfoForOthersScreen },
Message: { screen: MessageScreen },
TestPage: { screen: TestPage },
});

const ReleaseStack = createStackNavigator({
Release: { screen: ReleaseScreen },
Test: { screen: Test},
});

const ContactStack = createStackNavigator({
Contact: { screen: ContactScreen },
Test: { screen: Test},
GoodInfo: { screen: GoodInfoScreen },
UserInfoForOthers: { screen: UserInfoForOthersScreen},
SellInfoForOthers: { screen: SellInfoForOthersScreen },
BuyInfoForOthers: { screen: BuyInfoForOthersScreen },
Message: { screen: MessageScreen },
});

const UserStack = createStackNavigator({
Expand All @@ -56,6 +61,11 @@ const UserStack = createStackNavigator({
MyHistoryInfo: { screen: MyHistoryInfoScreen},
UserInfo: { screen: UserInfoScreen},
Login: { screen: LoginScreen },
GoodInfo: { screen: GoodInfoScreen },
UserInfoForOthers: { screen: UserInfoForOthersScreen},
SellInfoForOthers: { screen: SellInfoForOthersScreen },
BuyInfoForOthers: { screen: BuyInfoForOthersScreen },
Message: { screen: MessageScreen },
});

const TabBar = createBottomTabNavigator({
Expand All @@ -66,8 +76,10 @@ const TabBar = createBottomTabNavigator({
},{
defaultNavigationOptions: ({ navigation }) => ({
tabBarOnPress: (args) => {
if (args.navigation.state.routeName === 'Release') {
if (args.navigation.state.routeName === 'Release' && (!isLogin() || !isReleaseRendered())) {
navigation.reset([NavigationActions.navigate({routeName: 'Release'})], 0);
} else if (args.navigation.state.routeName === 'Contact' && (!isLogin() || !isContactRendered())) {
navigation.reset([NavigationActions.navigate({routeName: 'Contact'})], 0);
} else {
args.defaultHandler();
}
Expand Down Expand Up @@ -147,7 +159,6 @@ const TabBar = createBottomTabNavigator({
/*
const AppStack = createStackNavigator({
Tabs: TabBar,
TestPage: Test,
}, {
defaultNavigationOptions: {
headerStyle: {
Expand All @@ -158,5 +169,3 @@ const AppStack = createStackNavigator({
});*/

export default createAppContainer(TabBar);

export { Test };
118 changes: 118 additions & 0 deletions app-frontend/src/Network/Network.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import React, {Component} from 'react';
import Config from "../Config";

let common_url = 'http://202.120.40.8:30711/v1'; //服务器地址

let dev = "http://202.120.40.8:30711/v1";

export default class HTTP {
static addAvatar(url, params) {
return new Promise(function (resolve, reject) {
let formData = new FormData();
for (let key in params) {
formData.append(key, params[key]);
}
let file = {uri: params.path, type: 'application/octet-stream', name: 'image.jpg'};
formData.append("file", file);
fetch(common_url + url, {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data;charset=utf-8',
Authorization: ('Bearer ' + Config.JaccountToken.token),
},
body: formData,
}).then((response) => response.json())
.then((responseData) => {
//console.warn(responseData);
resolve(responseData);
})
.catch((err) => {
//console.warn(err);
reject(err);
});
});
}

static addContent(url, params) {
return new Promise(function (resolve, reject) {
let formData = new FormData();
for (let key in params) {
formData.append(key, params[key]);
}
let content = {uri: params.path, type: 'application/octet-stream', name: 'image.jpg'};
formData.append("content", content);
fetch(common_url + url, {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data;charset=utf-8',
Authorization: ('Bearer ' + Config.JaccountToken.token),
},
body: formData,
}).then((response) => response.json())
.then((responseData) => {
//console.warn(responseData);
resolve(responseData);
})
.catch((err) => {
//console.warn(err);
reject(err);
});
});
}

static get(url, params) {
// 将后台接口的公共部分拼接进去
url = dev + url;
//判断有木有参数
if (params) {
// 定一个空数组
let paramsArray = [];
// 拆分对象
Object.keys(params).forEach(key =>
paramsArray.push(key + "=" + params[key])
);
// 判断是否地址拼接的有没有 ?,当没有的时候,使用 ?拼接第一个参数,如果有参数拼接,则用&符号拼接后边的参数
if (url.search(/\?/) === -1) {
url = url + "?" + paramsArray.join("&");
} else {
url = url + "&" + paramsArray.join("&");
}
}
// 返回一个promise
return new Promise((resolve, reject) => {
//fetch请求
fetch(url, { method: "GET" })
.then(response => response.json())
.then(resulet => {
resolve(resulet);
})
.catch(error => {
reject(error);
});
});
}

static addInfo(url, formData) {
//console.warn((common_url + url));
//console.warn(formData);
return new Promise(function (resolve, reject) {
fetch((common_url + url), {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data;charset=utf-8',
Authorization: ('Bearer ' + Config.JaccountToken.token),
},
body: formData,
}).then((response) => response.json())
.then((responseData) => {
//console.warn(responseData);
resolve(responseData);
})
.catch((err) => {
//console.warn(err);
reject(err);
});
});
}

}
Loading

0 comments on commit bcb207e

Please sign in to comment.