| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- /**
- * 通知信息详情
- * @邠心vbe on 2023/08/17
- */
- import React, { Component } from 'react';
- import { View, Text, StyleSheet, ScrollView } from 'react-native';
- import apiNotification from '../../api/apiNotification';
- import Button from '../../components/Button';
- import Dialog from '../../components/Dialog';
- import TextView from '../../components/TextView';
- import { PageList } from '../Router';
- export default class Message 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
- });
- }
- }).catch(err => {
- toastShort(err);
- }).finally(() => {
- Dialog.dismissLoading();
- })
- }
- submitFeedback() {
- startPage(PageList.feedback);
- }
- render() {
- return (
- <View style={styles.container}>
- <View style={styles.header}>
- <TextView
- style={styles.textTitle}>
- {this.state.messageInfo.notificationTitle}
- </TextView>
- <TextView
- style={styles.textDate}
- numberOfLines={1}>
- {this.state.messageInfo.createTime}
- </TextView>
- </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'
- },
- textDate: {
- color: textSecondary,
- fontSize: 10,
- paddingTop: 1
- },
- header: {
- padding: 16,
- backgroundColor: pageBackground
- },
- textMessage: {
- color: textPrimary,
- fontSize: 14,
- padding: 16
- }
- })
|