Showing
2 changed files
with
47 additions
and
64 deletions
| @@ -54,6 +54,7 @@ | @@ -54,6 +54,7 @@ | ||
| 54 | buildConfiguration = "Debug" | 54 | buildConfiguration = "Debug" |
| 55 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | 55 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
| 56 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | 56 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
| 57 | + language = "" | ||
| 57 | shouldUseLaunchSchemeArgsEnv = "YES"> | 58 | shouldUseLaunchSchemeArgsEnv = "YES"> |
| 58 | <Testables> | 59 | <Testables> |
| 59 | <TestableReference | 60 | <TestableReference |
| @@ -80,9 +81,10 @@ | @@ -80,9 +81,10 @@ | ||
| 80 | </AdditionalOptions> | 81 | </AdditionalOptions> |
| 81 | </TestAction> | 82 | </TestAction> |
| 82 | <LaunchAction | 83 | <LaunchAction |
| 83 | - buildConfiguration = "Release" | 84 | + buildConfiguration = "Debug" |
| 84 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | 85 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
| 85 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | 86 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
| 87 | + language = "" | ||
| 86 | launchStyle = "0" | 88 | launchStyle = "0" |
| 87 | useCustomWorkingDirectory = "NO" | 89 | useCustomWorkingDirectory = "NO" |
| 88 | ignoresPersistentStateOnLaunch = "NO" | 90 | ignoresPersistentStateOnLaunch = "NO" |
| @@ -17,7 +17,6 @@ import Swiper from "react-native-swiper"; | @@ -17,7 +17,6 @@ import Swiper from "react-native-swiper"; | ||
| 17 | export default class Home extends Component { | 17 | export default class Home extends Component { |
| 18 | constructor(props) { | 18 | constructor(props) { |
| 19 | super(props); | 19 | super(props); |
| 20 | - this._renderMap = this._renderMap.bind(this); | ||
| 21 | this._swiper = this._swiper.bind(this); | 20 | this._swiper = this._swiper.bind(this); |
| 22 | this.state = { | 21 | this.state = { |
| 23 | ListData: [], | 22 | ListData: [], |
| @@ -33,9 +32,10 @@ export default class Home extends Component { | @@ -33,9 +32,10 @@ export default class Home extends Component { | ||
| 33 | } | 32 | } |
| 34 | componentWillMount() { | 33 | componentWillMount() { |
| 35 | this.getListData(); | 34 | this.getListData(); |
| 36 | - // this.getBannar(); | ||
| 37 | } | 35 | } |
| 36 | + | ||
| 38 | componentDidMount() {} | 37 | componentDidMount() {} |
| 38 | + | ||
| 39 | getListData() { | 39 | getListData() { |
| 40 | let that = this; | 40 | let that = this; |
| 41 | return fetch(`https://devpay.brae.co/test/insurance/topic`, { | 41 | return fetch(`https://devpay.brae.co/test/insurance/topic`, { |
| @@ -58,11 +58,12 @@ export default class Home extends Component { | @@ -58,11 +58,12 @@ export default class Home extends Component { | ||
| 58 | } else { | 58 | } else { |
| 59 | that.setState({ | 59 | that.setState({ |
| 60 | ListData: respJson.data.topic | 60 | ListData: respJson.data.topic |
| 61 | - }) | 61 | + }); |
| 62 | - console.log("首页列表",this.state.ListData) | 62 | + console.log("首页列表", this.state.ListData); |
| 63 | } | 63 | } |
| 64 | }); | 64 | }); |
| 65 | } | 65 | } |
| 66 | + | ||
| 66 | getBannar() { | 67 | getBannar() { |
| 67 | let that = this; | 68 | let that = this; |
| 68 | return fetch(`https://devpay.brae.co/test/insurance/banner`, { | 69 | return fetch(`https://devpay.brae.co/test/insurance/banner`, { |
| @@ -85,35 +86,12 @@ export default class Home extends Component { | @@ -85,35 +86,12 @@ export default class Home extends Component { | ||
| 85 | } else { | 86 | } else { |
| 86 | that.setState({ | 87 | that.setState({ |
| 87 | swiperImgList: respJson.data.banner | 88 | swiperImgList: respJson.data.banner |
| 88 | - }) | 89 | + }); |
| 89 | - console.log("bannar图",respJson.data.banner) | 90 | + console.log("bannar图", respJson.data.banner); |
| 90 | } | 91 | } |
| 91 | }); | 92 | }); |
| 92 | } | 93 | } |
| 93 | - _renderMap() { | 94 | + |
| 94 | - const { navigate } = this.props.navigation; | ||
| 95 | - return this.state.ListData.map((item, index) => { | ||
| 96 | - return ( | ||
| 97 | - <TouchableOpacity | ||
| 98 | - style={styles.itemContainer} | ||
| 99 | - key={index} | ||
| 100 | - onPress={() => navigate("CommonWebView", { item: item })} | ||
| 101 | - > | ||
| 102 | - <View style={styles.itemImgWrapper}> | ||
| 103 | - <Image source={item.imgurl} style={{ width: 74, height: 74 }} /> | ||
| 104 | - </View> | ||
| 105 | - <View style={styles.itemRightWrapper}> | ||
| 106 | - <Text style={styles.itemTextTop} numberOfLines={1}> | ||
| 107 | - {item.title} | ||
| 108 | - </Text> | ||
| 109 | - <Text style={styles.itemTextBottom} numberOfLines={1}> | ||
| 110 | - {item.context} | ||
| 111 | - </Text> | ||
| 112 | - </View> | ||
| 113 | - </TouchableOpacity> | ||
| 114 | - ); | ||
| 115 | - }); | ||
| 116 | - } | ||
| 117 | _swiper() { | 95 | _swiper() { |
| 118 | const { navigate } = this.props.navigation; | 96 | const { navigate } = this.props.navigation; |
| 119 | const { height, width } = Dimensions.get("window"); | 97 | const { height, width } = Dimensions.get("window"); |
| @@ -150,15 +128,21 @@ export default class Home extends Component { | @@ -150,15 +128,21 @@ export default class Home extends Component { | ||
| 150 | </View> | 128 | </View> |
| 151 | ); | 129 | ); |
| 152 | } | 130 | } |
| 131 | + | ||
| 153 | render() { | 132 | render() { |
| 154 | // console.log("首页的this.props", this); | 133 | // console.log("首页的this.props", this); |
| 155 | // console.log("render首页文章列表", this.state.ListData); | 134 | // console.log("render首页文章列表", this.state.ListData); |
| 156 | const { navigate } = this.props.navigation; | 135 | const { navigate } = this.props.navigation; |
| 157 | - const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | 136 | + const ds = new ListView.DataSource({ |
| 137 | + rowHasChanged: (r1, r2) => r1 !== r2 | ||
| 138 | + }); | ||
| 158 | const dataSource = ds.cloneWithRows(this.state.ListData); | 139 | const dataSource = ds.cloneWithRows(this.state.ListData); |
| 159 | return ( | 140 | return ( |
| 160 | <View style={styles.container}> | 141 | <View style={styles.container}> |
| 142 | + {/* 轮播图 */} | ||
| 161 | {this._swiper()} | 143 | {this._swiper()} |
| 144 | + | ||
| 145 | + {/* 保险产品入口 */} | ||
| 162 | <TouchableOpacity | 146 | <TouchableOpacity |
| 163 | style={styles.midContainer} | 147 | style={styles.midContainer} |
| 164 | onPress={() => navigate("AllProduct")} | 148 | onPress={() => navigate("AllProduct")} |
| @@ -173,17 +157,33 @@ export default class Home extends Component { | @@ -173,17 +157,33 @@ export default class Home extends Component { | ||
| 173 | style={styles.midArrow} | 157 | style={styles.midArrow} |
| 174 | /> | 158 | /> |
| 175 | </TouchableOpacity> | 159 | </TouchableOpacity> |
| 160 | + | ||
| 161 | + {/* 智能方案和健康问卷入口 */} | ||
| 162 | + <View style={styles.AIAndHealthContainer}> | ||
| 163 | + <TouchableOpacity style={styles.AHContainer}> | ||
| 164 | + <Image style={styles.AHIcon} /> | ||
| 165 | + <Text style={styles.AHText}>智能方案</Text> | ||
| 166 | + </TouchableOpacity> | ||
| 167 | + <TouchableOpacity style={styles.AHContainer}> | ||
| 168 | + <Image style={styles.AHIcon} /> | ||
| 169 | + <Text style={styles.AHText}>健康问卷</Text> | ||
| 170 | + </TouchableOpacity> | ||
| 171 | + </View> | ||
| 172 | + | ||
| 176 | <View style={styles.textContainer}> | 173 | <View style={styles.textContainer}> |
| 177 | <Text style={styles.minText}>保险头条</Text> | 174 | <Text style={styles.minText}>保险头条</Text> |
| 178 | </View> | 175 | </View> |
| 176 | + | ||
| 177 | + {/* 保险头条列表 */} | ||
| 179 | <ListView | 178 | <ListView |
| 180 | dataSource={dataSource} | 179 | dataSource={dataSource} |
| 181 | - enableEmptySections = {true} | 180 | + enableEmptySections={true} |
| 182 | renderRow={(item, index) => { | 181 | renderRow={(item, index) => { |
| 183 | return ( | 182 | return ( |
| 184 | <TouchableOpacity | 183 | <TouchableOpacity |
| 185 | style={styles.itemContainer} | 184 | style={styles.itemContainer} |
| 186 | - onPress={() => navigate("ArticleTemplate", { item: item, model: "topic" })} | 185 | + onPress={() => |
| 186 | + navigate("ArticleTemplate", { item: item, model: "topic" })} | ||
| 187 | > | 187 | > |
| 188 | <View style={styles.itemImgWrapper}> | 188 | <View style={styles.itemImgWrapper}> |
| 189 | <Image | 189 | <Image |
| @@ -203,36 +203,6 @@ export default class Home extends Component { | @@ -203,36 +203,6 @@ export default class Home extends Component { | ||
| 203 | ); | 203 | ); |
| 204 | }} | 204 | }} |
| 205 | /> | 205 | /> |
| 206 | - {/* <ScrollView | ||
| 207 | - style={styles.listContainer} | ||
| 208 | - automaticallyAdjustContentInsets={false} | ||
| 209 | - > | ||
| 210 | - {this.state.ListData.map((item, index) => { | ||
| 211 | - return ( | ||
| 212 | - <TouchableOpacity | ||
| 213 | - style={styles.itemContainer} | ||
| 214 | - key={index} | ||
| 215 | - onPress={() => navigate("ArticleTemplate", { item: item })} | ||
| 216 | - > | ||
| 217 | - <View style={styles.itemImgWrapper}> | ||
| 218 | - <Image | ||
| 219 | - source={{uri: item.image}} | ||
| 220 | - style={{ width: 74, height: 74 }} | ||
| 221 | - /> | ||
| 222 | - </View> | ||
| 223 | - <View style={styles.itemRightWrapper}> | ||
| 224 | - <Text style={styles.itemTextTop} numberOfLines={1}> | ||
| 225 | - {item.title} | ||
| 226 | - </Text> | ||
| 227 | - <Text style={styles.itemTextBottom} numberOfLines={1}> | ||
| 228 | - {item.summary} | ||
| 229 | - </Text> | ||
| 230 | - </View> | ||
| 231 | - </TouchableOpacity> | ||
| 232 | - ); | ||
| 233 | - })} | ||
| 234 | - <Text style={styles.scrollViewText}>没有更多了</Text> | ||
| 235 | - </ScrollView> */} | ||
| 236 | </View> | 206 | </View> |
| 237 | ); | 207 | ); |
| 238 | } | 208 | } |
| @@ -276,6 +246,17 @@ const styles = StyleSheet.create({ | @@ -276,6 +246,17 @@ const styles = StyleSheet.create({ | ||
| 276 | position: "absolute", | 246 | position: "absolute", |
| 277 | right: 15 | 247 | right: 15 |
| 278 | }, | 248 | }, |
| 249 | + AIAndHealthContainer: { | ||
| 250 | + flexDirection: "row", | ||
| 251 | + justifyContent: "space-around", | ||
| 252 | + alignItems: "center", | ||
| 253 | + marginTop: 10, | ||
| 254 | + // marginBottom: 10, | ||
| 255 | + backgroundColor: "white", | ||
| 256 | + }, | ||
| 257 | + AHContainer: {}, | ||
| 258 | + AHIcon: {}, | ||
| 259 | + AHText: {}, | ||
| 279 | textContainer: { | 260 | textContainer: { |
| 280 | backgroundColor: "#fff", | 261 | backgroundColor: "#fff", |
| 281 | marginTop: 10, | 262 | marginTop: 10, |
-
Please register or login to post a comment