/** * 充电评价页面 * @邠心vbe on 2021/04/30 */ import React from 'react'; import { Image, ScrollView, StyleSheet, Text, TextInput, View } from 'react-native'; import apiUser from '../../api/apiUser'; import Button from '../../components/Button'; import Dialog from '../../components/Dialog'; import { PageList } from '../Router'; export default class Rating extends React.Component { constructor(props) { super(props); this.state = { amenitiesNearby: 0, chargingExperience: 0, locationOfStation: 0, other: '', sitePk: 0, stationInfo: this.props.route.params } } componentDidMount() { if (this.state.stationInfo.id) { this.setState({ sitePk: this.state.stationInfo.id }); } } submit() { //console.log(this.state); if (this.state.locationOfStation == 0) { toastShort('Please rate \'Location of Station\''); return; } if (this.state.amenitiesNearby == 0) { toastShort('Please rate \'Amenities Nearby\''); return; } if (this.state.chargingExperience == 0) { toastShort('Please rate \'Charging Experience\''); return; } this.rating(); } rating() { Dialog.showProgressDialog(); apiUser.rateCharge(this.state).then(res => { Dialog.dismissLoading(); startPage(PageList.home) }).catch((err) => { Dialog.dismissLoading(); toastShort(err); }); } render() { return ( {this.state.stationInfo?.name} {this.state.stationInfo?.address} Location of Station { this.setState({ locationOfStation: value }); }} /> Amenities Nearby { this.setState({ amenitiesNearby: value }); }} /> Charging Experience { this.setState({ chargingExperience: value }); }} /> Others { this.setState({ other: t }); }} />