| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /**
- * 通知信息详情
- * @邠心vbe on 2023/08/17
- */
- import React, { Component } from 'react';
- import { View, StyleSheet, ScrollView } from 'react-native';
- import apiNotification from '../../api/apiNotification';
- import Button, { ElevationObject } from '../../components/Button';
- import Dialog from '../../components/Dialog';
- import HeaderTitle from '../../components/HeaderTitle';
- import TextView from '../../components/TextView';
- import { PageList } from '../Router';
- export default class ViewAlerts extends Component {
- constructor(props) {
- super(props);
- this.state = {
- id: "",
- messageInfo: {
- createTime: "",
- notificationText: "",
- notificationTitle: "",
- notificationType: ""
- }
- };
- }
- componentDidMount() {
- if (this.props.route?.params?.id) {
- this.setState({
- id: this.props.route?.params?.id
- }, () => {
- this.readMessage();
- })
- }
- }
- readMessage() {
- Dialog.showProgressDialog();
- apiNotification.readMessage(this.state.id).then(res => {
- if (res.data) {
- this.setState({
- messageInfo: res.data
- });
- this.setPageTitle();
- }
- }).catch(err => {
- toastShort(err);
- }).finally(() => {
- Dialog.dismissLoading();
- })
- }
- setPageTitle() {
- if (this.state.messageInfo.notificationTitle) {
- this.props.navigation.setOptions({
- headerTitle: () => (<HeaderTitle title={this.state.messageInfo.notificationTitle}/>)
- })
- }
- }
- submitFeedback() {
- startPage(PageList.feedback);
- }
- render() {
- return (
- <View style={styles.container}>
- <View style={styles.header}>
- <TextView
- style={styles.textTitle}>
- {this.state.messageInfo.notificationTitle}
- </TextView>
- <View style={ui.flexc}>
- <MaterialCommunityIcons
- name="clock-time-four-outline"
- color={textSecondary}
- size={12}/>
- <TextView
- style={styles.textDate}
- numberOfLines={1}>
- {this.state.messageInfo.createTime}
- </TextView>
- </View>
-
- </View>
- <ScrollView
- style={ui.flex1}>
- <TextView
- style={styles.textMessage}>
- {this.state.messageInfo.notificationText}
- </TextView>
- </ScrollView>
- { this.state.messageInfo.notificationType == "Review" &&
- <Button
- elevation={1}
- style={$margin(8, 16, 20)}
- text={$t("feedback.submitFeedback")}
- onClick={() => this.submitFeedback()}
- />
- }
- </View>
- );
- }
- }
- const styles = StyleSheet.create({
- container: {
- flex: 1,
- backgroundColor: pageBackground
- },
- textTitle: {
- color: textPrimary,
- fontSize: 18,
- fontWeight: 'bold',
- paddingBottom: 2
- },
- textDate: {
- color: textSecondary,
- fontSize: 10,
- paddingLeft: 2
- },
- header: {
- padding: 16,
- ...ElevationObject(1),
- backgroundColor: pageBackground
- },
- textMessage: {
- color: textPrimary,
- fontSize: 14,
- padding: 16
- }
- })
|