Authored by 张丽霞

学生认证,review by 孙凯

@@ -21,12 +21,17 @@ import appInitialState from './reducers/app/appInitialState'; @@ -21,12 +21,17 @@ import appInitialState from './reducers/app/appInitialState';
21 import studentInitialState from './reducers/student/studentInitialState'; 21 import studentInitialState from './reducers/student/studentInitialState';
22 22
23 import StudentContainer from './containers/StudentContainer'; 23 import StudentContainer from './containers/StudentContainer';
24 - 24 +import ZimaContainer from './containers/ZimaContainer';
  25 +import ProtocolContainer from './containers/ProtocolContainer';
25 import { 26 import {
26 setPlatform, 27 setPlatform,
27 setChannel, 28 setChannel,
28 } from './reducers/app/appActions'; 29 } from './reducers/app/appActions';
29 30
  31 +import {
  32 + setZiamUrl,
  33 +} from './reducers/student/studentActions';
  34 +
30 function getInitialState() { 35 function getInitialState() {
31 const _initState = { 36 const _initState = {
32 app: (new appInitialState()), 37 app: (new appInitialState()),
@@ -42,12 +47,28 @@ export default function native(platform) { @@ -42,12 +47,28 @@ export default function native(platform) {
42 render() { 47 render() {
43 const store = configureStore(getInitialState()); 48 const store = configureStore(getInitialState());
44 store.dispatch(setPlatform(platform)); 49 store.dispatch(setPlatform(platform));
45 -  
46 - return (  
47 - <Provider store={store}>  
48 - <StudentContainer />  
49 - </Provider>  
50 - ); 50 + let registerType = this.props.type;
  51 + let registerUrl = this.props.zimaUrl;
  52 + store.dispatch(setZiamUrl(registerUrl));
  53 + if (registerType == 'zima') {
  54 + return (
  55 + <Provider store={store}>
  56 + <ZimaContainer />
  57 + </Provider>
  58 + );
  59 + } else if(registerType == 'register'){
  60 + return (
  61 + <Provider store={store}>
  62 + <StudentContainer />
  63 + </Provider>
  64 + );
  65 + } else if(registerType == 'protocol'){
  66 + return (
  67 + <Provider store={store}>
  68 + <ProtocolContainer />
  69 + </Provider>
  70 + );
  71 + }
51 } 72 }
52 }); 73 });
53 74
  1 +'use strict';
  2 +
  3 +import React from 'react';
  4 +import ReactNative from 'react-native';
  5 +import {isEmptyObject} from '../../utils/Utils';
  6 +import Immutable, {Map} from 'immutable';
  7 +
  8 +const {
  9 + View,
  10 + Image,
  11 + Text,
  12 + TouchableOpacity,
  13 + Dimensions,
  14 + StyleSheet,
  15 +} = ReactNative;
  16 +
  17 +export default class LatterListView extends React.Component {
  18 +
  19 + constructor(props) {
  20 + super (props);
  21 + this.onTouchMove = this.onTouchMove.bind(this);
  22 + this.viewHeight = props.style.height;
  23 + }
  24 +
  25 + shouldComponentUpdate(nextProps){
  26 + if (Immutable.is(Immutable.fromJS(nextProps.dataSource), Immutable.fromJS(this.props.dataSource))) {
  27 + return false;
  28 + } else {
  29 + return true;
  30 + }
  31 + }
  32 +
  33 + onTouchMove(e) {
  34 + let {dataSource,distanceToContainer} = this.props;
  35 + let Y = e.nativeEvent.pageY - Math.ceil((this.viewHeight - dataSource.length * (itemHeight+2))/2) - 8 - distanceToContainer;
  36 + var index = Math.ceil(Y/(itemHeight+2))-1;
  37 + let sectionID = dataSource[index];
  38 + this.props.onLetterPress && this.props.onLetterPress(index,sectionID);
  39 + }
  40 +
  41 + render() {
  42 + let {dataSource} = this.props;
  43 + if (dataSource.length == 0) {
  44 + return null;
  45 + }
  46 +
  47 + let keyData = [];
  48 +
  49 + keyData.push(<Image key={'search'} style={styles.image} source={require('../../images/search.png')}/>);
  50 + for (var i = 0; i < dataSource.length; i++) {
  51 + let name = dataSource[i];
  52 + if (name == '0-9') {
  53 + name = '0';
  54 + }
  55 + keyData.push(<Text key={i} style={styles.text}>{name}</Text>);
  56 + }
  57 +
  58 + return (
  59 + <View style={[styles.container, {height: this.viewHeight}]} onTouchStart={this.onTouchMove} onTouchMove={this.onTouchMove} >
  60 + {keyData.map((elem, index) => {return elem;})}
  61 + </View>
  62 + );
  63 + }
  64 +}
  65 +
  66 +let {width, height} = Dimensions.get('window');
  67 +let itemHeight = 12;
  68 +
  69 +let styles = StyleSheet.create({
  70 + container: {
  71 + position: 'absolute',
  72 + width: 20,
  73 + bottom : 1,
  74 + right: 1,
  75 + backgroundColor: 'rgba(255,255,255,0.2)',
  76 + alignItems: 'center',
  77 + justifyContent: 'center',
  78 + },
  79 + text: {
  80 + justifyContent: 'center',
  81 + textAlign: 'center',
  82 + fontSize: 10,
  83 + color: 'black',
  84 + backgroundColor: 'transparent',
  85 + marginTop: 2,
  86 + },
  87 + image: {
  88 + width: 8,
  89 + height: 8,
  90 + },
  91 +});
@@ -12,47 +12,84 @@ import ReactNative, { @@ -12,47 +12,84 @@ import ReactNative, {
12 TouchableOpacity, 12 TouchableOpacity,
13 } from 'react-native'; 13 } from 'react-native';
14 import Immutable, {Map} from 'immutable'; 14 import Immutable, {Map} from 'immutable';
  15 +import LatterListView from './LatterListView';
  16 +import YH_SearchBar from '../../../common/components/YH_SearchBar';
  17 +
15 18
16 export default class ProvinceSchoolView extends Component { 19 export default class ProvinceSchoolView extends Component {
17 20
18 constructor(props) { 21 constructor(props) {
19 super(props); 22 super(props);
20 this._renderRow = this._renderRow.bind(this); 23 this._renderRow = this._renderRow.bind(this);
21 - this._renderHeader = this._renderHeader.bind(this);  
22 this._scrollToSection = this._scrollToSection.bind(this); 24 this._scrollToSection = this._scrollToSection.bind(this);
23 25
24 this.dataSource = new ListView.DataSource({ 26 this.dataSource = new ListView.DataSource({
25 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), 27 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
26 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2), 28 sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
27 }); 29 });
  30 + this._onTextChange = this._onTextChange.bind(this);
28 this.listView = null; 31 this.listView = null;
29 this.dataList = []; 32 this.dataList = [];
  33 + this.latterList = [];
  34 + this.dataListShow = [];
  35 + this.latterListShow = [];
30 } 36 }
31 37
32 componentDidMount() { 38 componentDidMount() {
33 39
34 } 40 }
35 41
36 - _renderHeader() {  
37 - return (  
38 - <View style={styles.header}>  
39 - <Text>  
40 - 搜索  
41 - </Text>  
42 - </View>  
43 - ); 42 + _onTextChange(text){
  43 + let newDataList = [];
  44 + let curViewType = this.props.resource.get('type');
  45 + let searchResultPageInfo = {
  46 + show: false,
  47 + type: {curViewType},
  48 + leftList: [],
  49 + rightList: [],
  50 + };
  51 + console.log(this.dataList);
  52 + console.log('this.dataList');
  53 + if (text != '') {
  54 + this.dataList.forEach((dataListItem, i) => {
  55 + let latter = this.latterList[i];
  56 + let list = dataListItem[latter].list;
  57 + let newDataListItem = {};
  58 + let newList = [];
  59 +
  60 + list.forEach((listItem, i) => {
  61 + let name = curViewType=='school' ? listItem.schoolName:listItem.addresseeName;
  62 + if (name.indexOf(text) != -1) {
  63 + newList.push(listItem);
  64 + }
  65 + });
  66 + if (newList.length) {
  67 + newDataListItem[latter]={list:newList,count:0,separatorCount:0};
  68 + newDataList.push(newDataListItem);
  69 + }
  70 + });
  71 + console.log('====0000');
  72 + console.log(newDataList);
  73 + if (newDataList.length) {
  74 + searchResultPageInfo.show = true;
  75 + searchResultPageInfo.leftList = newDataList;
  76 + }
  77 + }
  78 +
  79 + this.props.updateSearchResultPageInfo && this.props.updateSearchResultPageInfo(searchResultPageInfo);
44 } 80 }
45 81
46 _renderRow(rowData, sectionID, rowID, highlightRow) { 82 _renderRow(rowData, sectionID, rowID, highlightRow) {
47 let separatorLatter=''; 83 let separatorLatter='';
48 - let latterObject = this.dataList[rowID]; 84 + let latterObject = this.dataListShow[rowID];
49 for (var key in latterObject) { 85 for (var key in latterObject) {
50 if (latterObject.hasOwnProperty(key)) { 86 if (latterObject.hasOwnProperty(key)) {
51 separatorLatter = key; 87 separatorLatter = key;
52 } 88 }
53 } 89 }
54 - let rowDataList = rowData[separatorLatter];  
55 - let rowDataListImmulate = Immutable.fromJS(rowDataList) 90 + let rowDataList = rowData[separatorLatter].list;
  91 + let rowDataListImmulate = Immutable.fromJS(rowDataList);
  92 + let curViewType = this.props.resource.get('type');
56 return ( 93 return (
57 <View> 94 <View>
58 <View key={'sep' + rowID} style={styles.provinceLatterCell}> 95 <View key={'sep' + rowID} style={styles.provinceLatterCell}>
@@ -63,8 +100,7 @@ export default class ProvinceSchoolView extends Component { @@ -63,8 +100,7 @@ export default class ProvinceSchoolView extends Component {
63 {rowDataListImmulate.map((provinceItem, i) => { 100 {rowDataListImmulate.map((provinceItem, i) => {
64 return ( 101 return (
65 <TouchableOpacity activeOpacity={1.0} onPress={() => { 102 <TouchableOpacity activeOpacity={1.0} onPress={() => {
66 - console.log('---111111');  
67 - console.log(provinceItem); 103 + this._onTextChange('');
68 switch (this.props.resource.get('type')) { 104 switch (this.props.resource.get('type')) {
69 case 'province': 105 case 'province':
70 this.props.hideProvinceSelectView && this.props.hideProvinceSelectView(provinceItem); 106 this.props.hideProvinceSelectView && this.props.hideProvinceSelectView(provinceItem);
@@ -78,7 +114,11 @@ export default class ProvinceSchoolView extends Component { @@ -78,7 +114,11 @@ export default class ProvinceSchoolView extends Component {
78 }}> 114 }}>
79 <View style={styles.provinceCell}> 115 <View style={styles.provinceCell}>
80 <Text style={{marginLeft: 15}}> 116 <Text style={{marginLeft: 15}}>
81 - {provinceItem.get('addresseeName')} 117 + {curViewType == 'province' ?
  118 + provinceItem.get('addresseeName')
  119 + :provinceItem.get('schoolName')
  120 + }
  121 +
82 </Text> 122 </Text>
83 </View> 123 </View>
84 {i !== (rowDataListImmulate.size -1) ? 124 {i !== (rowDataListImmulate.size -1) ?
@@ -96,23 +136,37 @@ export default class ProvinceSchoolView extends Component { @@ -96,23 +136,37 @@ export default class ProvinceSchoolView extends Component {
96 ); 136 );
97 } 137 }
98 _scrollToSection(index,sectionID){ 138 _scrollToSection(index,sectionID){
99 - let item = this.sectionDataKey[sectionID]; 139 + console.log(index);
  140 + console.log(sectionID);
  141 + console.log('-------qqqq');
  142 + let {resource} = this.props;
  143 + let leftList = resource.get('leftList');
  144 + let rightList = resource.get('rightList');
  145 +
  146 + rightList = rightList.toArray();
  147 +
  148 + let item = this.dataListShow[index];
100 if (item) { 149 if (item) {
101 - if (!item.y) {  
102 - this.needScrollSection = sectionID;  
103 - item.count = ScrollCount(sectionID,this.sectionData);  
104 - this.props.setInitialListSize && this.props.setInitialListSize(item.count);  
105 - this.props.setBrandData && this.props.setBrandData(this.sectionDataKey, this.props.selectedChannelId);  
106 - } else {  
107 - this.listView.scrollTo({x: 0, y: item.y, animated: false});  
108 - } 150 + let distanceY = 30 * index + item[sectionID].count * 40 + item[sectionID].separatorCount * 1.5;
  151 + this.listView.scrollTo({x: 0, y: distanceY, animated: false});
109 } 152 }
110 } 153 }
111 154
112 render() { 155 render() {
113 - let {resource} = this.props; 156 + let {resource,searchResultPageInfo} = this.props;
114 let leftList = resource.get('leftList'); 157 let leftList = resource.get('leftList');
  158 + let rightList = resource.get('rightList');
  159 + let searchPlaceHolder = this.props.resource.get('type') == 'school' ? '搜索学校' : '搜索省份';
115 this.dataList = (leftList && leftList.size) ? leftList.toJS() : []; 160 this.dataList = (leftList && leftList.size) ? leftList.toJS() : [];
  161 + this.latterList = rightList.toArray();
  162 + this.dataListShow = this.dataList;
  163 + this.latterListShow = this.latterList;
  164 + if (searchResultPageInfo.get('show')) {
  165 + leftList = searchResultPageInfo.get('leftList');
  166 + rightList = searchResultPageInfo.get('rightList');
  167 + this.dataListShow = (leftList && leftList.size) ? leftList.toJS() : [];
  168 + this.latterListShow = rightList.toArray();
  169 + }
116 return ( 170 return (
117 <View style={styles.container}> 171 <View style={styles.container}>
118 <View style={styles.listViewContainer}> 172 <View style={styles.listViewContainer}>
@@ -120,11 +174,25 @@ export default class ProvinceSchoolView extends Component { @@ -120,11 +174,25 @@ export default class ProvinceSchoolView extends Component {
120 ref={(ref)=>this.listView=ref} 174 ref={(ref)=>this.listView=ref}
121 contentContainerStyle={[styles.contentContainerStyle]} 175 contentContainerStyle={[styles.contentContainerStyle]}
122 enableEmptySections={true} 176 enableEmptySections={true}
123 - dataSource={this.dataSource.cloneWithRows(this.dataList)} 177 + dataSource={this.dataSource.cloneWithRows(this.dataListShow)}
124 renderRow={this._renderRow} 178 renderRow={this._renderRow}
125 - renderHeader={this._renderHeader}  
126 showsHorizontalScrollIndicator={false} 179 showsHorizontalScrollIndicator={false}
127 /> 180 />
  181 + <LatterListView
  182 + style={{height: height - 64 - 200}}
  183 + dataSource={this.latterListShow}
  184 + distanceToContainer={200}
  185 + onLetterPress={this._scrollToSection}/>
  186 + </View>
  187 + <View style={styles.header}>
  188 + <YH_SearchBar
  189 + ref={(c) => {
  190 + this.searchBar = c;
  191 + }}
  192 + placeholder={searchPlaceHolder}
  193 + onClickCancel={this._onTextChange}
  194 + onTextChange={this._onTextChange}
  195 + />
128 </View> 196 </View>
129 <TouchableOpacity activeOpacity={1.0} onPress={() => { 197 <TouchableOpacity activeOpacity={1.0} onPress={() => {
130 console.log('--close'); 198 console.log('--close');
@@ -159,7 +227,7 @@ let styles = StyleSheet.create({ @@ -159,7 +227,7 @@ let styles = StyleSheet.create({
159 position: 'absolute', 227 position: 'absolute',
160 top: 0, 228 top: 0,
161 width: width, 229 width: width,
162 - height:height - 64 - 44, 230 + height:height - 64,
163 backgroundColor: 'rgba(0,0,0,0.3)', 231 backgroundColor: 'rgba(0,0,0,0.3)',
164 flexDirection: 'column-reverse', 232 flexDirection: 'column-reverse',
165 flex: 1, 233 flex: 1,
@@ -176,9 +244,10 @@ let styles = StyleSheet.create({ @@ -176,9 +244,10 @@ let styles = StyleSheet.create({
176 }, 244 },
177 listViewContainer: { 245 listViewContainer: {
178 height: height - 64 - 200, 246 height: height - 64 - 200,
179 - backgroundColor: '#dfe3e2', 247 + backgroundColor: 'white',
180 }, 248 },
181 contentContainerStyle: { 249 contentContainerStyle: {
  250 + width: width - 20,
182 backgroundColor: '#dfe3e2', 251 backgroundColor: '#dfe3e2',
183 }, 252 },
184 contentContainer: { 253 contentContainer: {
@@ -186,7 +255,6 @@ let styles = StyleSheet.create({ @@ -186,7 +255,6 @@ let styles = StyleSheet.create({
186 backgroundColor:'white', 255 backgroundColor:'white',
187 }, 256 },
188 provinceLatterCell: { 257 provinceLatterCell: {
189 - width: width - 30,  
190 marginLeft: 15, 258 marginLeft: 15,
191 height: 30, 259 height: 30,
192 backgroundColor: '#dfe3e2', 260 backgroundColor: '#dfe3e2',
@@ -16,6 +16,8 @@ import ReactNative, { @@ -16,6 +16,8 @@ import ReactNative, {
16 import RegisterInfoCell from './RegisterInfoCell'; 16 import RegisterInfoCell from './RegisterInfoCell';
17 import ProvinceSchoolView from './ProvinceSchoolView'; 17 import ProvinceSchoolView from './ProvinceSchoolView';
18 import Immutable, {Record, List, Map} from 'immutable'; 18 import Immutable, {Record, List, Map} from 'immutable';
  19 +import Prompt from '../../../coupon/components/coupon/Prompt';
  20 +
19 21
20 export default class Register extends Component { 22 export default class Register extends Component {
21 23
@@ -36,6 +38,7 @@ export default class Register extends Component { @@ -36,6 +38,7 @@ export default class Register extends Component {
36 offsety: 0, 38 offsety: 0,
37 pickerSelectValue: '', 39 pickerSelectValue: '',
38 }; 40 };
  41 + this.hideTipMesage = this.hideTipMesage.bind(this);
39 } 42 }
40 43
41 componentDidMount() { 44 componentDidMount() {
@@ -73,20 +76,28 @@ export default class Register extends Component { @@ -73,20 +76,28 @@ export default class Register extends Component {
73 76
74 _hideSchoolSelectView(schoolItem){ 77 _hideSchoolSelectView(schoolItem){
75 let newPickerInfoJson = this.state.pickerInfo.toJS(); 78 let newPickerInfoJson = this.state.pickerInfo.toJS();
76 - newPickerInfoJson.text = schoolItem.get('schoolName');  
77 - let newPickerInfo = Immutable.fromJS(newPickerInfoJson);  
78 - this.props.updateRegisterCellsInfo && this.props.updateRegisterCellsInfo(newPickerInfo); 79 + if (schoolItem) {
  80 + newPickerInfoJson.text = schoolItem.get('schoolName');
  81 + let newPickerInfo = Immutable.fromJS(newPickerInfoJson);
  82 + this.props.updateRegisterCellsInfo && this.props.updateRegisterCellsInfo(newPickerInfo);
  83 + }
79 this.props.hideSchoolSelectView && this.props.hideSchoolSelectView(schoolItem); 84 this.props.hideSchoolSelectView && this.props.hideSchoolSelectView(schoolItem);
80 } 85 }
81 86
82 _hideProvinceSelectView(provinceItem){ 87 _hideProvinceSelectView(provinceItem){
83 let newPickerInfoJson = this.state.pickerInfo.toJS(); 88 let newPickerInfoJson = this.state.pickerInfo.toJS();
84 - newPickerInfoJson.text = provinceItem.get('addresseeName');  
85 - let newPickerInfo = Immutable.fromJS(newPickerInfoJson);  
86 - this.props.updateRegisterCellsInfo && this.props.updateRegisterCellsInfo(newPickerInfo); 89 + if (provinceItem) {
  90 + newPickerInfoJson.text = provinceItem.get('addresseeName');
  91 + let newPickerInfo = Immutable.fromJS(newPickerInfoJson);
  92 + this.props.updateRegisterCellsInfo && this.props.updateRegisterCellsInfo(newPickerInfo);
  93 + }
87 this.props.hideProvinceSelectView && this.props.hideProvinceSelectView(provinceItem); 94 this.props.hideProvinceSelectView && this.props.hideProvinceSelectView(provinceItem);
88 } 95 }
89 96
  97 + hideTipMesage() {
  98 + this.props.showTipMesage && this.props.showTipMesage('');
  99 + }
  100 +
90 renderSeparator(sectionID, rowID, adjacentRowHighlighted) { 101 renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
91 return ( 102 return (
92 <View key={'sep' + rowID} style={styles.separator}> 103 <View key={'sep' + rowID} style={styles.separator}>
@@ -114,6 +125,7 @@ export default class Register extends Component { @@ -114,6 +125,7 @@ export default class Register extends Component {
114 <RegisterInfoCell 125 <RegisterInfoCell
115 resource={rowData} 126 resource={rowData}
116 onPressRegisterInfoCell={this._onPressRegisterInfoCell} 127 onPressRegisterInfoCell={this._onPressRegisterInfoCell}
  128 + updateRegisterCellsInfo={this.props.updateRegisterCellsInfo}
117 /> 129 />
118 ); 130 );
119 } 131 }
@@ -121,11 +133,12 @@ export default class Register extends Component { @@ -121,11 +133,12 @@ export default class Register extends Component {
121 133
122 134
123 render() { 135 render() {
124 - let {registerPageInfo} = this.props;  
125 - let {provinceSchoolPageInfo} = registerPageInfo; 136 + let {registerPageInfo,tipMessage} = this.props;
  137 + let {provinceSchoolPageInfo,searchResultPageInfo} = registerPageInfo;
  138 + let registerPageCells = registerPageInfo.get('registerPageCells').size?registerPageInfo.get('registerPageCells').toArray():[];
126 let dataSource ={ 139 let dataSource ={
127 - totalStudentRegister:[registerPageInfo.get('verifiedStudentTotal')],  
128 - registerPageCellsInfo:registerPageInfo.get('registerPageCells').size?registerPageInfo.get('registerPageCells').toArray():[], 140 + totalStudentRegister: [registerPageInfo.get('verifiedStudentTotal')],
  141 + registerPageCellsInfo: registerPageCells,
129 }; 142 };
130 let list = this.state.pickerList; 143 let list = this.state.pickerList;
131 return ( 144 return (
@@ -138,11 +151,26 @@ export default class Register extends Component { @@ -138,11 +151,26 @@ export default class Register extends Component {
138 renderSeparator={this.renderSeparator} 151 renderSeparator={this.renderSeparator}
139 renderFooter={()=>{ 152 renderFooter={()=>{
140 return <View style={styles.descriptionContainer}> 153 return <View style={styles.descriptionContainer}>
  154 + <TouchableOpacity activeOpacity={1.0} onPress={() => {
  155 + this.props.gotoProtocol && this.props.gotoProtocol();
  156 + }}>
141 <Text style={styles.descriptionText}>同意 157 <Text style={styles.descriptionText}>同意
142 <Text style={{color: 'blue'}}> 158 <Text style={{color: 'blue'}}>
143 Yoho!BUY有货学生认证协议 159 Yoho!BUY有货学生认证协议
144 </Text> 160 </Text>
145 </Text> 161 </Text>
  162 + </TouchableOpacity>
  163 +
  164 + <TouchableOpacity activeOpacity={1.0} onPress={() => {
  165 + console.log('--认证btn');
  166 + this.props.registerNow && this.props.registerNow();
  167 + }}>
  168 + <View style={styles.registerNowBtn}>
  169 + <Text style={{width: width - 30,textAlign: 'center',color:'white'}}>
  170 + 立即认证
  171 + </Text>
  172 + </View>
  173 + </TouchableOpacity>
146 174
147 </View> 175 </View>
148 }} 176 }}
@@ -184,7 +212,6 @@ export default class Register extends Component { @@ -184,7 +212,6 @@ export default class Register extends Component {
184 212
185 213
186 <TouchableOpacity activeOpacity={1.0} onPress={() => { 214 <TouchableOpacity activeOpacity={1.0} onPress={() => {
187 - console.log('---->');  
188 this.setState({pickerList:List()}); 215 this.setState({pickerList:List()});
189 }}> 216 }}>
190 <View style={styles.balckContainer} /> 217 <View style={styles.balckContainer} />
@@ -198,13 +225,20 @@ export default class Register extends Component { @@ -198,13 +225,20 @@ export default class Register extends Component {
198 <ProvinceSchoolView 225 <ProvinceSchoolView
199 style={styles.provinceSchoolView} 226 style={styles.provinceSchoolView}
200 resource={provinceSchoolPageInfo} 227 resource={provinceSchoolPageInfo}
  228 + searchResultPageInfo={searchResultPageInfo}
201 showProvinceSelectView={this.props.showProvinceSelectView} 229 showProvinceSelectView={this.props.showProvinceSelectView}
202 showSchoolSelectView={this.props.showSchoolSelectView} 230 showSchoolSelectView={this.props.showSchoolSelectView}
203 hideProvinceSelectView={this._hideProvinceSelectView} 231 hideProvinceSelectView={this._hideProvinceSelectView}
204 hideSchoolSelectView={this._hideSchoolSelectView} 232 hideSchoolSelectView={this._hideSchoolSelectView}
  233 + updateSearchResultPageInfo={this.props.updateSearchResultPageInfo}
205 /> 234 />
206 :null 235 :null
207 } 236 }
  237 + {(tipMessage && tipMessage != '') ? <Prompt
  238 + text={tipMessage}
  239 + duration={800}
  240 + onPromptHidden={this.hideTipMesage}
  241 + /> : null}
208 242
209 </View> 243 </View>
210 ); 244 );
@@ -269,10 +303,25 @@ let styles = StyleSheet.create({ @@ -269,10 +303,25 @@ let styles = StyleSheet.create({
269 complateTouchView: { 303 complateTouchView: {
270 height: 40, 304 height: 40,
271 width: 50, 305 width: 50,
272 - backgroundColor: 'red', 306 + justifyContent: 'center',
273 }, 307 },
274 provinceSchoolView: { 308 provinceSchoolView: {
275 -  
276 flex: 1, 309 flex: 1,
277 }, 310 },
  311 + descriptionContainer: {
  312 + flexDirection: 'column',
  313 + },
  314 + registerNowBtn: {
  315 + width: width - 30,
  316 + margin: 15,
  317 + height: 40,
  318 + backgroundColor: '#dfe3e2',
  319 + justifyContent: 'center',
  320 + borderRadius: 5,
  321 + },
  322 + descriptionText: {
  323 + paddingTop: 15,
  324 + textAlign: 'center',
  325 + }
  326 +
278 }); 327 });
@@ -11,6 +11,7 @@ import ReactNative, { @@ -11,6 +11,7 @@ import ReactNative, {
11 TouchableOpacity, 11 TouchableOpacity,
12 Image, 12 Image,
13 } from 'react-native'; 13 } from 'react-native';
  14 +import Immutable from 'immutable';
14 15
15 export default class RegisterInfoCell extends Component { 16 export default class RegisterInfoCell extends Component {
16 17
@@ -41,6 +42,18 @@ export default class RegisterInfoCell extends Component { @@ -41,6 +42,18 @@ export default class RegisterInfoCell extends Component {
41 style={styles.rightTextInput} 42 style={styles.rightTextInput}
42 editable={resource.get('touchAction')?false:true} 43 editable={resource.get('touchAction')?false:true}
43 defaultValue={resource.get('text')} 44 defaultValue={resource.get('text')}
  45 + maxLength={18}
  46 + onEndEditing={(event) => {
  47 + console.log('---text----');
  48 + if (resource.get('touchAction')) {
  49 + return;
  50 + } else {
  51 + let resourceJson = resource.toJS();
  52 + resourceJson.text = event.nativeEvent.text;
  53 + this.props.updateRegisterCellsInfo && this.props.updateRegisterCellsInfo(Immutable.fromJS(resourceJson));
  54 + }
  55 + console.log(event.nativeEvent.text);
  56 + }}
44 /> 57 />
45 {resource.get('touchAction')? 58 {resource.get('touchAction')?
46 <Image style={styles.arrow} 59 <Image style={styles.arrow}
@@ -4,6 +4,7 @@ export default keyMirror({ @@ -4,6 +4,7 @@ export default keyMirror({
4 4
5 SET_PLATFORM: null, 5 SET_PLATFORM: null,
6 SET_CHANNEL: null, 6 SET_CHANNEL: null,
  7 + SET_ZIMA_URL: null,
7 8
8 QUERY_REGISTER_PAGE_INFO_REQUEST: null, 9 QUERY_REGISTER_PAGE_INFO_REQUEST: null,
9 QUERY_REGISTER_PAGE_INFO_SUCCESS: null, 10 QUERY_REGISTER_PAGE_INFO_SUCCESS: null,
@@ -23,8 +24,12 @@ export default keyMirror({ @@ -23,8 +24,12 @@ export default keyMirror({
23 UPDATE_REGISTER_PAGE_CELLS: null, 24 UPDATE_REGISTER_PAGE_CELLS: null,
24 UPDATE_CUR_SCHOOL_INFO: null, 25 UPDATE_CUR_SCHOOL_INFO: null,
25 UPDATE_PROVINCE_SCHOOL_PAGE_INFO: null, 26 UPDATE_PROVINCE_SCHOOL_PAGE_INFO: null,
26 - 27 + UPDATE_PICKER_INFO: null,
  28 + UPDATE_SEARCH_RESULT_PAGE_INFO: null,
27 29
28 SELECT_PROVINCE_ITEM: null, 30 SELECT_PROVINCE_ITEM: null,
29 SELECT_SCHOOL_ITEM: null, 31 SELECT_SCHOOL_ITEM: null,
  32 +
  33 + SHOW_TIP_MESSAGE: null,
  34 + HIDE_TIP_MESSAGE: null,
30 }); 35 });
  1 +'use strict'
  2 +
  3 +import React, {Component} from 'react';
  4 +import ReactNative, {
  5 + StyleSheet,
  6 + Dimensions,
  7 + Platform,
  8 + View,
  9 + NativeModules,
  10 + InteractionManager,
  11 + NativeAppEventEmitter,
  12 + Text,
  13 +} from 'react-native'
  14 +
  15 +import {bindActionCreators} from 'redux';
  16 +import {connect} from 'react-redux';
  17 +import {Map} from 'immutable';
  18 +import * as studentActions from '../reducers/student/studentActions';
  19 +let WEBVIEW_REF = 'webview';
  20 +
  21 +const actions = [
  22 + studentActions,
  23 +];
  24 +
  25 +function mapStateToProps(state) {
  26 + return {
  27 + ...state
  28 + };
  29 +}
  30 +
  31 +function mapDispatchToProps(dispatch) {
  32 +
  33 + const creators = Map()
  34 + .merge(...actions)
  35 + .filter(value => typeof value === 'function')
  36 + .toObject();
  37 +
  38 + return {
  39 + actions: bindActionCreators(creators, dispatch),
  40 + dispatch
  41 + };
  42 +}
  43 +
  44 +class ZimaContainer extends Component {
  45 + constructor(props) {
  46 + super(props);
  47 + }
  48 +
  49 + render() {
  50 + let {student} = this.props;
  51 + let {registerPageInfo, zimaRegisterUrl} = student;
  52 + return (
  53 + <View style={styles.container}>
  54 + <Text style={styles.title}>认证协议</Text>
  55 + <Text style={styles.content}>1、全日制大学及硕士博士研究生</Text>
  56 + <Text style={styles.content}>2、学校在可选范围内,有部分学校可能暂未收录,后期会尽快添加</Text>
  57 + <Text style={styles.content}>3、每个学号只能认证一个有货账户</Text>
  58 + </View>
  59 + );
  60 + }
  61 +}
  62 +
  63 +let styles = StyleSheet.create({
  64 + container: {
  65 + flex: 1,
  66 + },
  67 + title: {
  68 + fontSize: 18,
  69 + marginTop: 30,
  70 + marginLeft: 15,
  71 + marginBottom: 20,
  72 + },
  73 + content: {
  74 + fontSize: 14,
  75 + marginLeft: 15,
  76 + marginRight:15,
  77 + lineHeight: 20,
  78 + }
  79 +
  80 +});
  81 +
  82 +export default connect(mapStateToProps, mapDispatchToProps)(ZimaContainer);
@@ -17,7 +17,7 @@ import {Map} from 'immutable'; @@ -17,7 +17,7 @@ import {Map} from 'immutable';
17 import * as studentActions from '../reducers/student/studentActions'; 17 import * as studentActions from '../reducers/student/studentActions';
18 import Student from '../components/student/Student'; 18 import Student from '../components/student/Student';
19 import Register from '../components/student/Register'; 19 import Register from '../components/student/Register';
20 -import Result from '../components/student/Result'; 20 +// import Result from '../components/student/Result';
21 21
22 const actions = [ 22 const actions = [
23 studentActions, 23 studentActions,
@@ -56,6 +56,10 @@ class StudentContainer extends Component { @@ -56,6 +56,10 @@ class StudentContainer extends Component {
56 56
57 this._hideProvinceSelectView = this._hideProvinceSelectView.bind(this); 57 this._hideProvinceSelectView = this._hideProvinceSelectView.bind(this);
58 this._hideSchoolSelectView = this._hideSchoolSelectView.bind(this); 58 this._hideSchoolSelectView = this._hideSchoolSelectView.bind(this);
  59 + this._registerNow = this._registerNow.bind(this);
  60 + this._updateSearchResultPageInfo = this._updateSearchResultPageInfo.bind(this);
  61 + this._gotoProtocol = this._gotoProtocol.bind(this);
  62 + this._showTipMesage = this._showTipMesage.bind(this);
59 } 63 }
60 64
61 componentDidMount() { 65 componentDidMount() {
@@ -101,27 +105,43 @@ class StudentContainer extends Component { @@ -101,27 +105,43 @@ class StudentContainer extends Component {
101 _hideSchoolSelectView(schoolItemInfo) { 105 _hideSchoolSelectView(schoolItemInfo) {
102 this.props.actions.hideSchoolSelectView(schoolItemInfo); 106 this.props.actions.hideSchoolSelectView(schoolItemInfo);
103 } 107 }
  108 + _updateSearchResultPageInfo(searchResultPageInfo){
  109 + this.props.actions.updateSearchResultPageInfo(searchResultPageInfo);
  110 + }
  111 +
  112 + _registerNow() {
  113 + this.props.actions.registerNow();
  114 + }
  115 +
  116 + _gotoProtocol() {
  117 + this.props.actions.gotoProtocol();
  118 + }
  119 +
  120 + _showTipMesage(message) {
  121 + this.props.actions.showTipMesage(message);
  122 + }
104 123
105 render() { 124 render() {
106 let {student} = this.props; 125 let {student} = this.props;
107 - let {registerPageInfo,productPageInfo} = student; 126 + let {registerPageInfo,productPageInfo,tipMessage} = student;
108 return ( 127 return (
109 <View style={styles.container}> 128 <View style={styles.container}>
110 - <Result 129 + <Register
  130 + registerPageInfo={registerPageInfo}
111 fetchStudentProducts={this._fetchStudentProducts} 131 fetchStudentProducts={this._fetchStudentProducts}
112 resource={productPageInfo} 132 resource={productPageInfo}
113 onPressProduct={this._onPressProduct} 133 onPressProduct={this._onPressProduct}
114 -  
115 - // <Register  
116 - // registerPageInfo={registerPageInfo}  
117 - // onPressRegisterInfoCell={this._onPressRegisterInfoCell}  
118 - // updateRegisterCellsInfo={this._updateRegisterCellsInfo}  
119 - // showProvinceSelectView={this._showProvinceSelectView}  
120 - // showSchoolSelectView={this._showSchoolSelectView}  
121 - // hideProvinceSelectView={this._hideProvinceSelectView}  
122 - // hideSchoolSelectView={this._hideSchoolSelectView}  
123 -  
124 - 134 + tipMessage={tipMessage}
  135 + onPressRegisterInfoCell={this._onPressRegisterInfoCell}
  136 + updateRegisterCellsInfo={this._updateRegisterCellsInfo}
  137 + showProvinceSelectView={this._showProvinceSelectView}
  138 + showSchoolSelectView={this._showSchoolSelectView}
  139 + hideProvinceSelectView={this._hideProvinceSelectView}
  140 + hideSchoolSelectView={this._hideSchoolSelectView}
  141 + registerNow={this._registerNow}
  142 + updateSearchResultPageInfo={this._updateSearchResultPageInfo}
  143 + gotoProtocol={this._gotoProtocol}
  144 + showTipMesage={this._showTipMesage}
125 /> 145 />
126 </View> 146 </View>
127 147
  1 +'use strict'
  2 +
  3 +import React, {Component} from 'react';
  4 +import ReactNative, {
  5 + StyleSheet,
  6 + Dimensions,
  7 + Platform,
  8 + View,
  9 + NativeModules,
  10 + InteractionManager,
  11 + NativeAppEventEmitter,
  12 + WebView,
  13 +} from 'react-native'
  14 +
  15 +import {bindActionCreators} from 'redux';
  16 +import {connect} from 'react-redux';
  17 +import {Map} from 'immutable';
  18 +import * as studentActions from '../reducers/student/studentActions';
  19 +let WEBVIEW_REF = 'webview';
  20 +
  21 +const actions = [
  22 + studentActions,
  23 +];
  24 +
  25 +function mapStateToProps(state) {
  26 + return {
  27 + ...state
  28 + };
  29 +}
  30 +
  31 +function mapDispatchToProps(dispatch) {
  32 +
  33 + const creators = Map()
  34 + .merge(...actions)
  35 + .filter(value => typeof value === 'function')
  36 + .toObject();
  37 +
  38 + return {
  39 + actions: bindActionCreators(creators, dispatch),
  40 + dispatch
  41 + };
  42 +}
  43 +
  44 +class ZimaContainer extends Component {
  45 + constructor(props) {
  46 + super(props);
  47 + }
  48 +
  49 + render() {
  50 + let {student} = this.props;
  51 + let {registerPageInfo, zimaRegisterUrl} = student;
  52 + return (
  53 + <View style={styles.container}>
  54 + <WebView
  55 + ref={WEBVIEW_REF}
  56 + automaticallyAdjustContentInsets={false}
  57 + style={styles.webView}
  58 + source={{uri: zimaRegisterUrl}}
  59 + javaScriptEnabled={true}
  60 + domStorageEnabled={true}
  61 + decelerationRate="normal"
  62 + onNavigationStateChange={this.onNavigationStateChange}
  63 + onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
  64 + startInLoadingState={true}
  65 + />
  66 + </View>
  67 + );
  68 + }
  69 +}
  70 +
  71 +let styles = StyleSheet.create({
  72 + container: {
  73 + flex: 1,
  74 + },
  75 +
  76 +});
  77 +
  78 +export default connect(mapStateToProps, mapDispatchToProps)(ZimaContainer);
@@ -3,9 +3,11 @@ @@ -3,9 +3,11 @@
3 import ReactNative from 'react-native'; 3 import ReactNative from 'react-native';
4 import StudentService from '../../services/StudentService'; 4 import StudentService from '../../services/StudentService';
5 import Immutable, {Record, List, Map} from 'immutable'; 5 import Immutable, {Record, List, Map} from 'immutable';
  6 +const querystring = require('query-string');
6 7
7 const { 8 const {
8 SET_PLATFORM, 9 SET_PLATFORM,
  10 + SET_ZIMA_URL,
9 11
10 QUERY_REGISTER_PAGE_INFO_REQUEST, 12 QUERY_REGISTER_PAGE_INFO_REQUEST,
11 QUERY_REGISTER_PAGE_INFO_SUCCESS, 13 QUERY_REGISTER_PAGE_INFO_SUCCESS,
@@ -26,10 +28,14 @@ const { @@ -26,10 +28,14 @@ const {
26 UPDATE_REGISTER_PAGE_CELLS, 28 UPDATE_REGISTER_PAGE_CELLS,
27 UPDATE_CUR_SCHOOL_INFO, 29 UPDATE_CUR_SCHOOL_INFO,
28 UPDATE_PROVINCE_SCHOOL_PAGE_INFO, 30 UPDATE_PROVINCE_SCHOOL_PAGE_INFO,
  31 + UPDATE_SEARCH_RESULT_PAGE_INFO,
29 32
30 SELECT_PROVINCE_ITEM, 33 SELECT_PROVINCE_ITEM,
31 SELECT_SCHOOL_ITEM, 34 SELECT_SCHOOL_ITEM,
32 35
  36 + SHOW_TIP_MESSAGE,
  37 + HIDE_TIP_MESSAGE,
  38 +
33 } = require('../../constants/actionTypes').default; 39 } = require('../../constants/actionTypes').default;
34 40
35 export function setPlatform(platform) { 41 export function setPlatform(platform) {
@@ -39,6 +45,13 @@ export function setPlatform(platform) { @@ -39,6 +45,13 @@ export function setPlatform(platform) {
39 }; 45 };
40 } 46 }
41 47
  48 +export function setZiamUrl(url) {
  49 + return {
  50 + type: SET_ZIMA_URL,
  51 + payload: url
  52 + };
  53 +}
  54 +
42 export function queryRegisterPageInfoRequest() { 55 export function queryRegisterPageInfoRequest() {
43 return { 56 return {
44 type: QUERY_REGISTER_PAGE_INFO_REQUEST 57 type: QUERY_REGISTER_PAGE_INFO_REQUEST
@@ -139,6 +152,13 @@ export function updateProvinceSchoolPageInfo(provinceSchoolPageInfo) { @@ -139,6 +152,13 @@ export function updateProvinceSchoolPageInfo(provinceSchoolPageInfo) {
139 } 152 }
140 } 153 }
141 154
  155 +export function updateSearchResultPageInfo(searchResultPageInfo) {
  156 + return {
  157 + type:UPDATE_SEARCH_RESULT_PAGE_INFO,
  158 + payload:searchResultPageInfo
  159 + }
  160 +}
  161 +
142 export function selectSchoolItem(schoolItem) { 162 export function selectSchoolItem(schoolItem) {
143 return { 163 return {
144 type:SELECT_SCHOOL_ITEM, 164 type:SELECT_SCHOOL_ITEM,
@@ -153,6 +173,19 @@ export function selectProvinceItem(provinceItem) { @@ -153,6 +173,19 @@ export function selectProvinceItem(provinceItem) {
153 } 173 }
154 } 174 }
155 175
  176 +export function showTipMesage(message) {
  177 + return {
  178 + type: SHOW_TIP_MESSAGE,
  179 + payload: message
  180 + }
  181 +}
  182 +
  183 +export function hideTipMesage() {
  184 + return {
  185 + type: HIDE_TIP_MESSAGE,
  186 + }
  187 +}
  188 +
156 export function getRegisterPageInfo() { 189 export function getRegisterPageInfo() {
157 return (dispatch, getState) => { 190 return (dispatch, getState) => {
158 dispatch(queryRegisterPageInfoRequest()); 191 dispatch(queryRegisterPageInfoRequest());
@@ -210,8 +243,6 @@ export function getSchool(code=11) { @@ -210,8 +243,6 @@ export function getSchool(code=11) {
210 dispatch(querySchoolInfoListRequest()); 243 dispatch(querySchoolInfoListRequest());
211 return new StudentService(app.host).getSchool() 244 return new StudentService(app.host).getSchool()
212 .then(result => { 245 .then(result => {
213 - console.log('getSchool');  
214 - console.log(result);  
215 let schoolInfo = processSchoolData(result); 246 let schoolInfo = processSchoolData(result);
216 let curSchoolInfo = { 247 let curSchoolInfo = {
217 isFetching: false, 248 isFetching: false,
@@ -220,7 +251,6 @@ export function getSchool(code=11) { @@ -220,7 +251,6 @@ export function getSchool(code=11) {
220 } 251 }
221 schoolCodeValueInfo[code]=curSchoolInfo; 252 schoolCodeValueInfo[code]=curSchoolInfo;
222 //学校待处理 253 //学校待处理
223 - // dispatch(updateProvinceLatterList(provinceInfo));  
224 dispatch(querySchoolInfoListSuccess({schoolCodeValueInfo,curSchoolInfo})); 254 dispatch(querySchoolInfoListSuccess({schoolCodeValueInfo,curSchoolInfo}));
225 }) 255 })
226 .catch(error => { 256 .catch(error => {
@@ -243,7 +273,27 @@ function processSchoolData(schoolList){ @@ -243,7 +273,27 @@ function processSchoolData(schoolList){
243 latterList.push(key); 273 latterList.push(key);
244 } 274 }
245 } 275 }
246 - return {latterList,latterSchoolObject}; 276 + //字母数组排序
  277 + latterList.sort();
  278 + //字母省份排序
  279 + let latterSchoollistSort = [];
  280 + let countOfBefore= 0;
  281 + let separatorCount=0;
  282 + for (var i = 0; i < latterList.length; i++) {
  283 + let key = latterList[i];
  284 + let latterObject = {};
  285 + latterObject[key] = {
  286 + list: latterSchoolObject[key],
  287 + count: countOfBefore,
  288 + separatorCount,
  289 + }
  290 + latterObject[key].count = countOfBefore;
  291 + latterSchoollistSort.push(latterObject);
  292 + countOfBefore += latterSchoolObject[key].length;
  293 + separatorCount += latterSchoolObject[key].length - 1;
  294 + }
  295 +
  296 + return {latterList,latterSchoollistSort};
247 } 297 }
248 298
249 function processProvinceData(provinceList){ 299 function processProvinceData(provinceList){
@@ -264,11 +314,19 @@ function processProvinceData(provinceList){ @@ -264,11 +314,19 @@ function processProvinceData(provinceList){
264 latterList.sort(); 314 latterList.sort();
265 //字母省份排序 315 //字母省份排序
266 let latterProvincelistSort = []; 316 let latterProvincelistSort = [];
  317 + let countOfBefore= 0;
  318 + let separatorCount=0;
267 for (var i = 0; i < latterList.length; i++) { 319 for (var i = 0; i < latterList.length; i++) {
268 let key = latterList[i]; 320 let key = latterList[i];
269 let latterObject = {}; 321 let latterObject = {};
270 - latterObject[key] = latterProvinceObject[key]; 322 + latterObject[key] = {
  323 + list: latterProvinceObject[key],
  324 + count: countOfBefore,
  325 + separatorCount,
  326 + };
271 latterProvincelistSort.push(latterObject); 327 latterProvincelistSort.push(latterObject);
  328 + countOfBefore += latterProvinceObject[key].length;
  329 + separatorCount += latterProvinceObject[key].length -1;
272 } 330 }
273 return {latterList,latterProvincelistSort}; 331 return {latterList,latterProvincelistSort};
274 } 332 }
@@ -360,11 +418,8 @@ export function updateRegisterCellsInfo(registerCellInfo) { @@ -360,11 +418,8 @@ export function updateRegisterCellsInfo(registerCellInfo) {
360 let {registerPageCells} = registerPageInfo; 418 let {registerPageCells} = registerPageInfo;
361 let newRegisterPageCellsJson = registerPageCells.toJS(); 419 let newRegisterPageCellsJson = registerPageCells.toJS();
362 registerPageCells.forEach((pageCellItem, i) => { 420 registerPageCells.forEach((pageCellItem, i) => {
363 - console.log('hahaha');  
364 if (pageCellItem.get('type') == registerCellInfo.get('type')) { 421 if (pageCellItem.get('type') == registerCellInfo.get('type')) {
365 newRegisterPageCellsJson[i] = registerCellInfo.toJS(); 422 newRegisterPageCellsJson[i] = registerCellInfo.toJS();
366 - console.log('------->>>');  
367 - console.log(newRegisterPageCellsJson[i]);  
368 } 423 }
369 }); 424 });
370 dispatch(updateRegisterPageCells(Immutable.fromJS(newRegisterPageCellsJson))); 425 dispatch(updateRegisterPageCells(Immutable.fromJS(newRegisterPageCellsJson)));
@@ -407,6 +462,7 @@ export function showSchoolSelectView(){ @@ -407,6 +462,7 @@ export function showSchoolSelectView(){
407 leftList: curSchoolListInfo.get('curSchoolWithLatterList'), 462 leftList: curSchoolListInfo.get('curSchoolWithLatterList'),
408 rightList: curSchoolListInfo.get('curSchoolLatterList'), 463 rightList: curSchoolListInfo.get('curSchoolLatterList'),
409 } 464 }
  465 +
410 dispatch(updateProvinceSchoolPageInfo(provinceSchoolPageInfo)); 466 dispatch(updateProvinceSchoolPageInfo(provinceSchoolPageInfo));
411 return; 467 return;
412 } else { 468 } else {
@@ -414,12 +470,10 @@ export function showSchoolSelectView(){ @@ -414,12 +470,10 @@ export function showSchoolSelectView(){
414 dispatch(querySchoolInfoListRequest()); 470 dispatch(querySchoolInfoListRequest());
415 return new StudentService(app.host).getSchool(curProvinceItem.get('areaCode')) 471 return new StudentService(app.host).getSchool(curProvinceItem.get('areaCode'))
416 .then(result => { 472 .then(result => {
417 - console.log('getSchool');  
418 - console.log(result);  
419 let schoolInfo = processSchoolData(result); 473 let schoolInfo = processSchoolData(result);
420 let curSchoolInfo = { 474 let curSchoolInfo = {
421 isFetching: false, 475 isFetching: false,
422 - curSchoolWithLatterList: schoolInfo.latterSchoolObject, 476 + curSchoolWithLatterList: schoolInfo.latterSchoollistSort,
423 curSchoolLatterList: schoolInfo.latterList, 477 curSchoolLatterList: schoolInfo.latterList,
424 } 478 }
425 schoolCodeValueInfo[curProvinceItem.get('areaCode')]=curSchoolInfo; 479 schoolCodeValueInfo[curProvinceItem.get('areaCode')]=curSchoolInfo;
@@ -428,7 +482,7 @@ export function showSchoolSelectView(){ @@ -428,7 +482,7 @@ export function showSchoolSelectView(){
428 provinceSchoolPageInfo = { 482 provinceSchoolPageInfo = {
429 show: true, 483 show: true,
430 type: 'school', 484 type: 'school',
431 - leftList: schoolInfo.latterSchoolObject, 485 + leftList: schoolInfo.latterSchoollistSort,
432 rightList: schoolInfo.latterList, 486 rightList: schoolInfo.latterList,
433 } 487 }
434 dispatch(updateProvinceSchoolPageInfo(provinceSchoolPageInfo)); 488 dispatch(updateProvinceSchoolPageInfo(provinceSchoolPageInfo));
@@ -474,3 +528,86 @@ export function hideSchoolSelectView(schoolItemInfo){ @@ -474,3 +528,86 @@ export function hideSchoolSelectView(schoolItemInfo){
474 } 528 }
475 }; 529 };
476 } 530 }
  531 +
  532 +export function registerNow() {
  533 + return (dispatch, getState) => {
  534 + let {app, student} = getState();
  535 + let {registerPageInfo} = student;
  536 + let {registerPageCells} = registerPageInfo;
  537 + let tipMessage = '';
  538 + let clientType,collegeName,educationDegree,enrollmentYear,idNumber,name;
  539 + let registerNowAction =(uid) => {
  540 + registerPageCells.map((cellItem, i) => {
  541 + if (cellItem.get('text') == '') {
  542 + tipMessage = cellItem.get('title')+'不可为空';
  543 + }
  544 + switch (cellItem.get('type')) {
  545 + case 'name':
  546 + name = cellItem.get('text');
  547 + break;
  548 + case 'id':
  549 + idNumber = cellItem.get('text');
  550 + break;
  551 + case 'school':
  552 + collegeName = cellItem.get('text');
  553 + break;
  554 + case 'education':
  555 + educationDegree = cellItem.get('text');
  556 + break;
  557 + case 'years':
  558 + enrollmentYear = cellItem.get('text');
  559 + break;
  560 + }
  561 + });
  562 + if (tipMessage !== '') {
  563 + dispatch(showTipMesage(tipMessage));
  564 + return;
  565 + } else {
  566 + let params = {
  567 + college_name: collegeName,
  568 + education_degree: educationDegree,
  569 + enrollment_year: enrollmentYear,
  570 + uid: uid,
  571 + };
  572 + let jsonParam = querystring.stringify(params);
  573 + let backUrl = 'http://m.yohobuy.com/activity/student/verify?' +
  574 + jsonParam + '&';
  575 +
  576 +
  577 + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.h5","params":{"id":"74”,”islogin":"Y","type":9,"updateflag":"2adfw4e243abdefwqg1234dfarq","url":"${backUrl}"}}`;
  578 + let testUrl = `https://feature.yoho.cn/NEWS/1222APPWEEKNEWSBOY/index.html?title=一周速报&share_id=1445&openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"param\":{\"share_id\":\"1445\",\"title\":\"一周速报\"},\"share\":\"/operations/api/v5/webshare/getShare\",\"shareparam\":{\"share_id\":\"1445\"},\"title\":\"一周速报\",\"url\":\"https://feature.yoho.cn/NEWS/1222APPWEEKNEWSBOY/index.html\"}}`;
  579 + return new StudentService(app.host).verifyidentity(uid, idNumber, name, url)
  580 + .then(result => {
  581 + console.log('--身份认证成功---');
  582 + console.log(result);
  583 + console.log('===========');
  584 + ReactNative.NativeModules.YH_StudentHelper.jumpToZimaVC(result);
  585 + })
  586 + .catch(error => {
  587 + console.log('--身份认证失败---');
  588 + console.log(error);
  589 + });
  590 + }
  591 + };
  592 +
  593 + ReactNative.NativeModules.YH_CommonHelper.uid()
  594 + .then(uid => {
  595 + registerNowAction(uid);
  596 + })
  597 + .catch(error => {
  598 + ReactNative.NativeModules.YH_CommonHelper.login()
  599 + .then(uid => {
  600 + registerNowAction(uid);
  601 + })
  602 + .catch(error => {
  603 +
  604 + });
  605 + });
  606 + };
  607 +}
  608 +
  609 +export function gotoProtocol() {
  610 + return (dispatch, getState) => {
  611 + ReactNative.NativeModules.YH_StudentHelper.jumpToRegisterProtocolPage();
  612 + };
  613 +}
@@ -27,16 +27,22 @@ let InitialState = Record({ @@ -27,16 +27,22 @@ let InitialState = Record({
27 leftList: List(), 27 leftList: List(),
28 rightList: List(), 28 rightList: List(),
29 })), 29 })),
  30 + searchResultPageInfo: new (Record({
  31 + show: false,
  32 + type: '', //provice or school
  33 + leftList: List(),
  34 + rightList: List(),
  35 + })),
  36 + pickerInfo: Map(),//当前页面选中的cell的信息
30 })), 37 })),
31 38
32 - province: Map(),  
33 -  
34 -  
35 productPageInfo: new (Record({ 39 productPageInfo: new (Record({
36 isFetching: false, 40 isFetching: false,
37 studentProducts: Map(), 41 studentProducts: Map(),
38 error: null, 42 error: null,
39 })), 43 })),
  44 + tipMessage: '',
  45 + zimaRegisterUrl: '',
40 }); 46 });
41 47
42 export default InitialState; 48 export default InitialState;
@@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable'; @@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable';
5 5
6 const { 6 const {
7 SET_PLATFORM, 7 SET_PLATFORM,
  8 + SET_ZIMA_URL,
8 9
9 QUERY_REGISTER_PAGE_INFO_REQUEST, 10 QUERY_REGISTER_PAGE_INFO_REQUEST,
10 QUERY_REGISTER_PAGE_INFO_SUCCESS, 11 QUERY_REGISTER_PAGE_INFO_SUCCESS,
@@ -25,15 +26,23 @@ const { @@ -25,15 +26,23 @@ const {
25 UPDATE_REGISTER_PAGE_CELLS, 26 UPDATE_REGISTER_PAGE_CELLS,
26 UPDATE_CUR_SCHOOL_INFO, 27 UPDATE_CUR_SCHOOL_INFO,
27 UPDATE_PROVINCE_SCHOOL_PAGE_INFO, 28 UPDATE_PROVINCE_SCHOOL_PAGE_INFO,
  29 + UPDATE_PICKER_INFO,
  30 + UPDATE_SEARCH_RESULT_PAGE_INFO,
28 31
29 SELECT_PROVINCE_ITEM, 32 SELECT_PROVINCE_ITEM,
30 SELECT_SCHOOL_ITEM, 33 SELECT_SCHOOL_ITEM,
  34 +
  35 + SHOW_TIP_MESSAGE,
  36 + HIDE_TIP_MESSAGE,
31 } = require('../../constants/actionTypes').default; 37 } = require('../../constants/actionTypes').default;
32 38
33 const initialState = new InitialState; 39 const initialState = new InitialState;
34 40
35 export default function studentReducer(state=initialState, action) { 41 export default function studentReducer(state=initialState, action) {
36 switch(action.type) { 42 switch(action.type) {
  43 + case SET_ZIMA_URL:{
  44 + return state.set('zimaRegisterUrl', action.payload);
  45 + }
37 case QUERY_REGISTER_PAGE_INFO_REQUEST: { 46 case QUERY_REGISTER_PAGE_INFO_REQUEST: {
38 return state.setIn(['registerPageInfo', 'isFetching'], true); 47 return state.setIn(['registerPageInfo', 'isFetching'], true);
39 } 48 }
@@ -74,12 +83,24 @@ export default function studentReducer(state=initialState, action) { @@ -74,12 +83,24 @@ export default function studentReducer(state=initialState, action) {
74 case UPDATE_PROVINCE_SCHOOL_PAGE_INFO: { 83 case UPDATE_PROVINCE_SCHOOL_PAGE_INFO: {
75 return state.setIn(['registerPageInfo', 'provinceSchoolPageInfo'], Immutable.fromJS(action.payload)); 84 return state.setIn(['registerPageInfo', 'provinceSchoolPageInfo'], Immutable.fromJS(action.payload));
76 } 85 }
  86 + case UPDATE_SEARCH_RESULT_PAGE_INFO: {
  87 + return state.setIn(['registerPageInfo', 'searchResultPageInfo'], Immutable.fromJS(action.payload));
  88 + }
  89 + case UPDATE_PICKER_INFO: {
  90 + return state.setIn(['registerPageInfo', 'pickerInfo'],action.payload);
  91 + }
77 case SELECT_PROVINCE_ITEM: { 92 case SELECT_PROVINCE_ITEM: {
78 return state.setIn(['registerPageInfo', 'curProvinceItem'], Immutable.fromJS(action.payload)); 93 return state.setIn(['registerPageInfo', 'curProvinceItem'], Immutable.fromJS(action.payload));
79 } 94 }
80 case SELECT_SCHOOL_ITEM: { 95 case SELECT_SCHOOL_ITEM: {
81 return state.setIn(['registerPageInfo', 'cueSchoolItem'], Immutable.fromJS(action.payload)); 96 return state.setIn(['registerPageInfo', 'cueSchoolItem'], Immutable.fromJS(action.payload));
82 } 97 }
  98 + case SHOW_TIP_MESSAGE: {
  99 + return state.set('tipMessage',action.payload);
  100 + }
  101 + case HIDE_TIP_MESSAGE: {
  102 + return state.set('tipMessage','');
  103 + }
83 } 104 }
84 105
85 return state; 106 return state;
@@ -84,4 +84,24 @@ export default class StudentService { @@ -84,4 +84,24 @@ export default class StudentService {
84 throw(error); 84 throw(error);
85 }); 85 });
86 } 86 }
  87 + // verifyidentity(uid, idNumber, name, url)
  88 + async verifyidentity(uid, cert_no, name, page_url, client_type='iphone') {
  89 + return await this.api.get({
  90 + url: '',
  91 + body: {
  92 + method: 'app.student.verifyIdentity',
  93 + uid,
  94 + cert_no,
  95 + name,
  96 + page_url,
  97 + client_type,
  98 + }
  99 + })
  100 + .then((json) => {
  101 + return json;
  102 + })
  103 + .catch((error) => {
  104 + throw(error);
  105 + });
  106 + }
87 } 107 }
  1 +'use strict';
  2 +import ReactNative from 'react-native';
  3 +const {
  4 + PixelRatio,
  5 +} = ReactNative;
  6 +
  7 +export function getSlicedUrl(src, width, height, mode = 1) {
  8 + if (!src) {
  9 + return '';
  10 + }
  11 +
  12 + width = PixelRatio.getPixelSizeForLayoutSize(width);
  13 + height = PixelRatio.getPixelSizeForLayoutSize(height);
  14 + let newSrc = src;
  15 + if (src.indexOf('imageView') === -1 && src.indexOf('imageMogr') === -1) {
  16 + newSrc = src + '?imageView2/' + mode + '/w/' + width + '/h/' + height;
  17 + } else {
  18 + newSrc = src.replace('{mode}', mode)
  19 + .replace('{width}', width)
  20 + .replace('{height}', height);
  21 + }
  22 + return newSrc;
  23 +}
  24 +
  25 +export function isEmptyObject(obj) {
  26 + for (var key in obj) {
  27 + return false;
  28 + }
  29 + return true;
  30 +}
  31 +
  32 +export function ScrollCount(sessionID,list) {
  33 + let index = 0;
  34 + for(let k in list) {
  35 + let name = k;
  36 + index += list[k].length;
  37 + if (name == sessionID) {
  38 + break;
  39 + }
  40 + }
  41 + return index;
  42 +}