Commit aa361867 by 姜雷

完善页面逻辑

parent 4550a18f
import Taro, { request } from '@tarojs/taro';
import { BASE_SERVER_URL } from '../constants/index';
type ResponseDataEntity = {
code: number;
msg: string;
data: any;
[propName: string]: any;
};
type ResponseEntity = {
data: ResponseDataEntity;
[propName: string]: any;
};
const fetch = (entity: request.Param) => {
return Taro.request({
...entity,
header: {
token: '',
},
url: BASE_SERVER_URL + entity.url,
}).then(({ data }: ResponseEntity) => {
if (data.code === 1000) {
return data;
}
throw data;
});
};
export default fetch;
import fetch from './index';
export const login = data =>
fetch({
url: '/wx/api/user/login2',
data: data,
});
export const fetchAllCampus = () =>
fetch({
url: '/dcxy/api/campus/all',
});
......@@ -15,7 +15,18 @@ button {
background-color: #6180f4;
color: #fff;
}
button[disabled]:not([type]) {
color: rgba(0, 0, 0, 0.3);
background-color: #f7f7f7;
border: 1px solid #eee;
}
.button-hover {
background-color: #456beb;
color: #fff;
}
.topBr {
width: 100%;
border-top: 1px solid #eee;
}
......@@ -26,14 +26,15 @@ class App extends Component {
*/
config: Config = {
pages: [
'pages/Login/Login',
'pages/CheckTelephone/CheckTelephone',
'pages/Register/Register',
'pages/index/index',
'pages/Feedback/Feedback',
'pages/Order/OrderDetail/OrderDetail',
'pages/Order/OrderPay/OrderPay',
'pages/Order/OrderList/OrderList',
'pages/Register/Register',
// 'pages/Login/Login',
// 'pages/CheckTelephone/CheckTelephone',
// 'pages/Feedback/Feedback',
// 'pages/Order/OrderDetail/OrderDetail',
// 'pages/Order/OrderPay/OrderPay',
// 'pages/Order/OrderList/OrderList',
'pages/SelectCampus/SelectCampus',
],
window: {
backgroundTextStyle: 'light',
......
import { ComponentClass } from 'react';
import Taro, { Component } from '@tarojs/taro';
import { View, Text, Image } from '@tarojs/components';
import { View } from '@tarojs/components';
import './Vcode.scss';
type PageOwnProps = {
text: string;
text?: string;
};
type PageState = {
defaultText: string;
......
export const ADD = 'ADD'
export const MINUS = 'MINUS'
export const APP_ID = 'wxf5912b79bba23663';
export const BASE_SERVER_URL = 'https://ex-dev-selfbase.168cad.top';
......@@ -62,6 +62,7 @@
margin-bottom: 52px;
}
.Login-regist-btn {
display: inline;
color: #fff;
}
.Login-btn {
......
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Button, Text, Input } from '@tarojs/components';
import { connect } from '@tarojs/redux';
import { View, Button, Text, Input, Navigator } from '@tarojs/components';
import Vcode from '../../components/Vcode/Vcode';
import './Login.scss';
type PageStateProps = {
APP_ID: string;
};
type PageOwnProps = {};
type PageState = {
loginWay: string;
vcode: string;
......@@ -21,16 +14,10 @@ type PageState = {
code: string;
};
type IProps = PageStateProps & PageOwnProps;
interface Login {
props: IProps;
state: PageState;
}
@connect(({ constants }) => ({
APP_ID: constants.APP_ID,
}))
class Login extends Component {
config: Config = {
navigationBarTitleText: '多彩校园',
......@@ -63,16 +50,14 @@ class Login extends Component {
className={`Login-loginWay-item ${
loginWay === 'account' ? 'active' : ''
}`}
onClick={() => this.toggleLoginWay('account')}
>
onClick={() => this.toggleLoginWay('account')}>
账号登录
</Text>
<Text
className={`Login-loginWay-item ${
loginWay === 'tel' ? 'active' : ''
}`}
onClick={() => this.toggleLoginWay('tel')}
>
onClick={() => this.toggleLoginWay('tel')}>
手机号登录
</Text>
</View>
......@@ -114,7 +99,11 @@ class Login extends Component {
<View className='Login-regist'>
还没有账号?
<Text className='Login-regist-btn'>注册</Text>
<Navigator
className='Login-regist-btn'
url='/pages/Register/Register'>
注册
</Navigator>
</View>
<Button className='Login-btn'>登录</Button>
</View>
......@@ -122,4 +111,4 @@ class Login extends Component {
}
}
export default Login as ComponentClass<PageOwnProps, PageState>;
export default Login as ComponentClass<{}, PageState>;
.Register {
box-sizing: border-box;
border-top: 1px solid #eee;
width: 100%;
height: 100%;
.registerBox {
......@@ -19,17 +18,33 @@
.registerBox-item {
display: flex;
justify-content: space-between;
align-items: center;
height: 80px;
line-height: 80px;
border-bottom: 1px solid #eee;
color: #333;
.loginBox-placeholder,
.noVlaue {
color: #999;
}
.loginBox-input {
width: 100%;
height: 100%;
font-size: 28px;
}
}
.sexBox {
width: 200px;
display: flex;
.sexBox-item {
display: flex;
align-items: center;
margin-left: 40px;
}
.sexBox-icon {
width: 40px;
height: 40px;
margin-right: 20px;
}
}
.registerBox-getVcode {
position: relative;
......@@ -59,13 +74,13 @@
align-items: center;
color: #999;
.registerBox-agreeCheck {
box-sizing: border-box;
width: 30px;
height: 30px;
border: 4px solid #999;
border-radius: 50%;
margin-right: 16px;
}
.service-deal {
color: #456beb;
}
}
.registerBox-button {
margin: 40px 32px 0;
......
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import {
View,
Text,
Image,
Button,
Input,
RadioGroup,
Radio,
Label,
} from '@tarojs/components';
import { View, Text, Image, Button, Input } from '@tarojs/components';
import Vcode from '../../components/Vcode/Vcode';
import baseIcon from '../../images/login/icon_jibenxinxi@2x.png';
import pwdIcon from '../../images/login/icon_passworld@2x.png';
import areaIcon from '../../images/login/icon_quyu@2x.png';
import pwdHideIcon from '../../images/login/setting_invisible_icon@2x.png';
import pwdShowIcon from '../../images/login/setting_see_icon@2x.png';
import radioIcon from '../../images/login/pc_nor_icon@2x.png';
import radioCheckIcon from '../../images/login/pc_sel_icon@2x.png';
import './Register.scss';
import agreeIcon from '../../images/login/icon_zhuce_sel@2x.png';
import agreeNotIcon from '../../images/login/icon_zhuce_nor@2x.png';
import { connect } from '@tarojs/redux';
import { StoreState } from 'src/store/rootReducers/userinfo';
type PageStateProps = {
userinfo: StoreState;
};
type PageDispatchProps = {
// updateUserInfo: (e: User) => void;
};
type PageOwnProps = {};
type PageState = {
name: string;
cellphone: string;
pwd: string;
checkPwd: string;
sex: string;
agree: boolean;
showPwd: boolean;
showCheckPwd: boolean;
};
type IProps = PageStateProps & PageDispatchProps;
interface Register {
props: IProps;
state: PageState;
}
@connect(({ userinfo }) => ({
userinfo,
}))
class Register extends Component {
config: Config = {
navigationBarTitleText: '注册',
navigationStyle: 'custom',
};
constructor(props) {
constructor(props: IProps) {
super(props);
this.state = {
name: '',
cellphone: '',
pwd: '',
sex: '',
checkPwd: '',
sex: 'Male',
agree: false,
showPwd: false,
showCheckPwd: false,
};
}
showCampusSelector = () => {};
setSex = ({ detail: { value } }) => {
setSex(value: string) {
this.setState({
sex: value,
});
};
updateName = e => {
return e + 'asdad';
};
getRegister = () => {
}
updateName({ detail: { value } }) {
this.setState({
name: value,
});
}
validateRegisterEntity(): boolean {
const { name, cellphone, pwd, checkPwd, agree } = this.state;
if (!name) {
console.log('请输入姓名');
return false;
}
if (!cellphone || cellphone.length !== 11) {
console.log('请输入手机号码');
return false;
}
if (!pwd) {
console.log('请输入密码');
return false;
}
if (!checkPwd) {
console.log('请输入确认密码');
return false;
}
if (pwd != checkPwd) {
console.log('请输入确认密码');
return false;
}
if (!agree) {
console.log('请勾选同意条款');
return false;
}
return true;
}
getRegister() {
if (this.validateRegisterEntity()) {
const { name, cellphone, pwd, checkPwd, sex } = this.state;
console.log(name, cellphone, pwd, checkPwd, sex);
console.log('跳转首页');
};
}
}
navToCampus() {
Taro.navigateTo({
url: '/pages/SelectCampus/SelectCampus',
});
}
togglePwdBox() {
this.setState(({ showPwd }: PageState) => ({
showPwd: !showPwd,
}));
}
togglePwdCheckBox() {
this.setState(({ showCheckPwd }: PageState) => ({
showCheckPwd: !showCheckPwd,
}));
}
toggleAgreeState() {
this.setState(({ agree }: PageState) => ({
agree: !agree,
}));
}
render() {
const { name, sex } = this.state;
const { sex, showPwd, showCheckPwd, agree } = this.state;
const { userinfo } = this.props;
return (
<View className='Register'>
<View className='Register topBr'>
<View className='registerBox'>
<View className='registerBox-title'>
<Image className='registerBox-icon' src={baseIcon} />
......@@ -69,41 +150,60 @@ class Register extends Component {
<View className='registerBox-item'>
<Input
className='loginBox-input'
value={name}
onInput={this.updateName}
placeholderClass='loginBox-placeholder'
placeholder='输入您的姓名'
onInput={({ detail: { value } }) => {
this.setState({
name: value.trim(),
});
return value.trim();
}}
maxLength={20}
/>
<View className='loginBox-input sexBox'>
<View
className='sexBox-item'
onClick={() => this.setSex('Female')}>
{sex === 'Female' ? (
<Image className='sexBox-icon' src={radioCheckIcon} />
) : (
<Image className='sexBox-icon' src={radioIcon} />
)}
<Text></Text>
</View>
<View className='sexBox-item' onClick={() => this.setSex('Male')}>
{sex === 'Male' ? (
<Image className='sexBox-icon' src={radioCheckIcon} />
) : (
<Image className='sexBox-icon' src={radioIcon} />
)}
<Text></Text>
</View>
</View>
{/* <RadioGroup
className='loginBox-input sexBox'
onChange={this.setSex}>
<Label
className={`choose-item ${sex == 'Male' ? 'checked' : ''}`}>
<Radio value='Male'>男</Radio>
</Label>
<Label
className={`choose-item ${sex == 'Female' ? 'checked' : ''}`}>
<Radio value='Female'>女</Radio>
</Label>
</RadioGroup> */}
</View>
<View className='registerBox-item'>
<Input
className='loginBox-input'
placeholderClass='loginBox-placeholder'
placeholder='请输入注册的手机号码'
maxLength={20}
type='number'
onInput={({ detail: { value } }) => {
this.setState({
cellphone: value,
});
return value;
}}
maxLength={11}
/>
</View>
<View className='registerBox-item'>
<Input
className='loginBox-input'
placeholderClass='loginBox-placeholder'
placeholder='请输入验证码'
maxLength={20}
maxLength={6}
/>
<Text className='registerBox-getVcode'>获取验证码</Text>
<Vcode vcode-classname='registerBox-getVcode' />
</View>
<View className='registerBox-title'>
<Image className='registerBox-icon' src={pwdIcon} />
......@@ -112,45 +212,64 @@ class Register extends Component {
<View className='registerBox-item'>
<Input
className='loginBox-input'
password
placeholderClass='loginBox-placeholder'
password={!showPwd}
placeholder='密码由6-20位组成'
maxLength={20}
/>
<Image className='registerBox-pwdIcon' src={pwdHideIcon} />
<Image
className='registerBox-pwdIcon'
src={showPwd ? pwdShowIcon : pwdHideIcon}
onClick={this.togglePwdBox}
/>
</View>
<View className='registerBox-item'>
<Input
className='loginBox-input'
password
placeholderClass='loginBox-placeholder'
password={!showCheckPwd}
placeholder='确认密码'
maxLength={20}
/>
<Image className='registerBox-pwdIcon' src={pwdHideIcon} />
<Image
className='registerBox-pwdIcon'
src={showCheckPwd ? pwdShowIcon : pwdHideIcon}
onClick={this.togglePwdCheckBox}
/>
</View>
<View className='registerBox-title'>
<Image className='registerBox-icon' src={areaIcon} />
<Text className='registerBox-text'>区域信息</Text>
</View>
<View className='registerBox-item'>
<Input
className='loginBox-input'
password
placeholder='请填写真实区域信息'
maxLength={20}
/>
<View className='registerBox-item' onClick={this.navToCampus}>
{userinfo.campusId ? (
<Text>{userinfo.campusName}</Text>
) : (
<Text className='noVlaue'>请填写真实区域信息</Text>
)}
</View>
</View>
<View className='registerBox-agreeBox'>
<View className='registerBox-agreeCheck' />
<View className='registerBox-agreeBox' onClick={this.toggleAgreeState}>
{agree ? (
<Image className='registerBox-agreeCheck' src={agreeIcon} />
) : (
<Image className='registerBox-agreeCheck' src={agreeNotIcon} />
)}
<Text>同意条款</Text>
<Text>《多彩校园服务协议》</Text>
<Text className='service-deal'>《多彩校园服务协议》</Text>
</View>
{agree ? (
<Button className='registerBox-button' onClick={this.getRegister}>
确 认
</Button>
) : (
<Button className='registerBox-button' disabled>
确 认
</Button>
)}
</View>
);
}
}
export default Register as ComponentClass<PageOwnProps, PageState>;
export default Register as ComponentClass<IProps, PageState>;
.Location {
background-color: #fff;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
.searchBox {
display: flex;
height: 90px;
}
.searchInput {
box-sizing: border-box;
flex: 1;
padding-left: 20px;
height: 80px;
line-height: 80px;
border: 2px solid #f0f0f0;
border-radius: 8px;
word-break: break-all;
margin-top: 16px;
margin-left: 40px;
width: 550px;
height: 56px;
}
.searchBtn {
height: 90px;
line-height: 90px;
margin-left: 24px;
margin-right: 40px;
font-size: 30px;
color: #456beb;
}
.searchIcon {
width: 30px;
height: 30px;
margin-right: 10px;
vertical-align: middle;
}
.infoBar {
position: fixed;
top: 262px;
right: 30px;
width: 40px;
text-align: center;
font-size: 26px;
color: #666;
}
.infoItem {
height: 50px;
line-height: 50px;
}
.infoToast {
position: fixed;
width: 180px;
height: 180px;
line-height: 180px;
background-color: rgba(254, 148, 10, 0.4);
left: 9999px;
top: 480px;
margin-left: -90px;
text-align: center;
font-size: 116px;
color: #fff;
opacity: 0;
transition: opacity 500ms;
}
.show {
opacity: 1;
left: 50%;
}
.locationList {
height: 100%;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
.locationTitle {
padding: 0 40px;
height: 70px;
line-height: 70px;
background-color: #ebebeb;
font-size: 26px;
color: #999;
}
.locationItem {
width: 530px;
line-height: 80px;
margin: 0 auto;
font-size: 30px;
color: #444;
border-bottom: 2px solid #ebebeb;
word-break: break-all;
}
}
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { connect } from '@tarojs/redux';
import { View, Text, Input, Image } from '@tarojs/components';
import SearchIcon from '../../images/login/icon_search@2x.png';
import { Campus, CampusList } from '../../types/Campus/Campus';
import { fetchAllCampus } from '../../api/login';
import { StoreState, updateUserInfo } from '../../store/rootReducers/userinfo';
import User from 'src/types/User/User';
const resData = [
{
id: 47,
schoolId: 36,
name: '保定职业技术学院1',
mobile: '15212121222',
address: '河北省保定市新市区朝阳南大街613号',
introduce: '',
fd_version: '1',
isDel: 0,
openLattice: 'N',
firstPin: 'B',
},
{
id: 126,
schoolId: 36,
name: '保定职业技术学院测试学院1',
mobile: '15232569878',
address: '敖德萨所大所多',
introduce: '奥术大师多',
fd_version: '2',
isDel: 0,
openLattice: 'N',
firstPin: 'B',
},
{
id: 12,
schoolId: 6,
name: '成师温江校区',
mobile: '13608207722',
address: '海科路东段99号',
introduce: '',
fd_version: '1',
isDel: 0,
openLattice: 'N',
firstPin: 'C',
},
{
id: 116,
schoolId: 200004,
name: '成都正阳1.0校区 ',
mobile: '15881097999',
address: '四川省成都市温江区',
introduce: '用于虚拟客户体验使用',
fd_version: '1',
isDel: 0,
openLattice: 'N',
firstPin: 'C',
},
];
type PageStateProps = {
userinfo: StoreState;
};
type PageDispatchProps = {
updateUserInfo: (e: User) => void;
};
type PageState = {
campusList: CampusList;
filterList: CampusList;
filterName: string;
};
type IProps = PageStateProps & PageDispatchProps;
interface SelectCampus {
props: IProps;
state: PageState;
}
@connect(
({ userinfo }) => ({
userinfo,
}),
dispatch => ({
updateUserInfo(entity: User) {
dispatch(updateUserInfo(entity));
},
}),
)
class SelectCampus extends Component {
config: Config = {
navigationBarTitleText: '检索学校',
};
constructor(props: IProps) {
super(props);
this.state = {
filterName: '',
campusList: [],
filterList: [],
};
}
componentWillMount() {
fetchAllCampus()
.then(res => {
console.log(res);
let campusIndexArr: Array<string> = [];
let campusList: CampusList = [];
res.data.map((campus: Campus) => {
let firstPin = campus.firstPin;
if (firstPin) {
let index = campusIndexArr.indexOf(firstPin);
if (index > -1) {
campusList[index].children.push(campus);
} else {
campusIndexArr.push(firstPin);
campusList.push({
firstPin: firstPin,
children: [campus],
});
}
}
});
this.setState({
campusList: campusList,
filterList: campusList,
});
})
.catch(err => {
console.log(err);
let campusIndexArr: Array<string> = [];
let campusList: CampusList = [];
resData.map((campus: Campus) => {
let firstPin = campus.firstPin;
if (firstPin) {
let index = campusIndexArr.indexOf(firstPin);
if (index > -1) {
campusList[index].children.push(campus);
} else {
campusIndexArr.push(firstPin);
campusList.push({
firstPin: firstPin,
children: [campus],
});
}
}
});
this.setState({
campusList: campusList,
filterList: campusList,
});
});
this.setState(({ campusList }: PageState) => ({
filterList: campusList,
}));
}
searchList() {
let { filterName, campusList } = this.state;
if (filterName) {
const filterList = campusList.reduce(
(totalArr: CampusList, campusItem) => {
let arr = campusItem.children.filter(
i => i.name.indexOf(filterName) > -1,
);
if (arr.length > 0) {
totalArr.push({
firstPin: campusItem.firstPin,
children: arr,
});
}
return totalArr;
},
[],
);
this.setState({
filterList: filterList,
});
} else {
this.setState({
filterList: campusList,
});
}
}
bindCampus({ id, name, schoolId }: Campus) {
this.props.updateUserInfo({
campusId: id,
campusName: name,
schoolId: schoolId,
});
Taro.navigateBack();
}
render() {
const { filterList, filterName } = this.state;
return (
<View className='Location topBr'>
<View className='searchBox'>
<Input
className='br8 searchInput'
value={filterName}
onInput={({ detail: { value } }) =>
this.setState({
filterName: value.trim(),
})
}
type='text'
placeholder='请输入学校名称'
/>
<View className='searchBtn' onClick={this.searchList}>
<Image className='searchIcon' src={SearchIcon} />
<Text>搜索</Text>
</View>
</View>
<View className='locationList'>
{filterList.map(campusItem => (
<View key={campusItem.firstPin} className='locationArea'>
<View id={campusItem.firstPin} className='locationTitle'>
{campusItem.firstPin}
</View>
{campusItem.children.map((campus, index) => (
<View
key={index}
className='locationItem'
onClick={() => this.bindCampus(campus)}>
{campus.name}
</View>
))}
</View>
))}
</View>
</View>
);
}
}
export default SelectCampus as ComponentClass;
.Index {
padding: 50px;
.Index-loading-text {
animation-name: loadingAnima;
animation-direction: 2s;
animation-iteration-count: infinite;
}
}
@keyframes loadingAnima {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Button, Text } from '@tarojs/components';
// import { connect } from '@tarojs/redux';
// import { add, minus, asyncAdd } from '../../actions/counter';
import { View, Button } from '@tarojs/components';
import './index.scss';
// #region 书写注意
//
// 目前 typescript 版本还无法在装饰器模式下将 Props 注入到 Taro.Component 中的 props 属性
// 需要显示声明 connect 的参数类型并通过 interface 的方式指定 Taro.Component 子类的 props
// 这样才能完成类型检查和 IDE 的自动提示
// 使用函数模式则无此限制
// ref: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20796
//
// #endregion
import { login } from '../../api/login';
type PageStateProps = {
counter: {
......@@ -23,52 +11,73 @@ type PageStateProps = {
};
};
type PageDispatchProps = {
// add: () => void;
// dec: () => void;
// asyncAdd: () => any;
};
type PageDispatchProps = {};
type PageOwnProps = {};
type PageState = {};
type PageState = {
loadingText: string;
};
type IProps = PageStateProps & PageDispatchProps & PageOwnProps;
interface Index {
props: IProps;
state: PageState;
}
class Index extends Component {
/**
* 指定config的类型声明为: Taro.Config
*
* 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型
* 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string
* 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型
*/
config: Config = {
config: Config = {};
constructor(props) {
super(props);
this.state = {
loadingText: 'Loading...',
};
}
componentWillMount() {
Taro.login({
success(res) {
Taro.getStorage({
key: 'token',
})
.then(res => {
console.log(res);
},
})
.catch(() => {
this.loginHandle();
});
}
navToLogin() {
Taro.navigateTo({
url: '/pages/Register/Register',
loginHandle() {
Taro.login().then(res => {
console.log(res);
login({
code: res.code,
})
.then(res => {
const data = res.data;
})
.catch(err => {
console.log(err);
this.setState({
loadingText: '',
});
});
// Taro.setStorage({ key: 'token', data: res.code });
});
}
navToLogin() {
this.loginHandle();
// Taro.navigateTo({
// url: '/pages/Register/Register',
// });
}
render() {
const { loadingText } = this.state;
return (
<View className='index'>
<View>
<Text>Hello, World</Text>
</View>
<View className='Index'>
<View className='Index-loading-text'>{loadingText}</View>
<Button className='dec_btn' onClick={this.navToLogin}>
登录
</Button>
......@@ -77,11 +86,4 @@ class Index extends Component {
}
}
// #region 导出注意
//
// 经过上面的声明后需要将导出的 Taro.Component 子类修改为子类本身的 props 属性
// 这样在使用这个子类时 Ts 才不会提示缺少 JSX 类型参数错误
//
// #endregion
export default Index as ComponentClass<PageOwnProps, PageState>;
export default Index as ComponentClass<IProps, PageState>;
import { combineReducers } from 'redux';
import constants from './rootReducers/constants';
import userinfo from './rootReducers/userinfo';
import OrderList from '../pages/Order/OrderList/store';
export default combineReducers({
constants,
userinfo,
OrderList,
});
interface StoreState {
import User from '../../types/User/User';
import Action from '../../types/Store/Actions';
export interface StoreState extends User {
login: boolean;
token: string;
id: string;
campusId: string;
name: string;
headPic: string;
}
const INITIAL_STATE = {
login: false,
token: '',
id: '',
campusId: '',
campusId: null,
campusName: '',
schoolId: null,
name: '',
headPic: '',
};
export default function userinfo(state: StoreState = INITIAL_STATE) {
export const updateUserInfo = (entity: User): Action => ({
type: 'UPDATE_USERINFO',
payload: entity,
});
export default function userinfo(
state: StoreState = INITIAL_STATE,
actions: Action,
): StoreState {
switch (actions.type) {
case 'UPDATE_USERINFO':
return {
...state,
...actions.payload,
};
default:
return state;
}
}
export type Campus = {
address?: string;
fd_version?: string;
firstPin: string;
id: number;
introduce?: string;
isDel?: number;
mobile?: string;
name: string;
openLattice?: string;
schoolId: number;
};
export type CampusListItem = {
firstPin: string;
children: Array<Campus>;
};
export interface CampusList extends Array<CampusListItem> {}
export default Campus;
type User = {
id?: string;
campusId?: number | null;
campusName?: string;
schoolId?: number | null;
name?: string;
headPic?: string;
};
export default User;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment