Campaign.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. * 活动信息详情
  3. * @邠心vbe on 2023/08/17
  4. */
  5. import React, { Component } from 'react';
  6. import { View, Text, StyleSheet, ScrollView, Image } from 'react-native';
  7. import apiNotification from '../../api/apiNotification';
  8. import Button from '../../components/Button';
  9. import Dialog from '../../components/Dialog';
  10. import { PageList } from '../Router';
  11. export default class Campaign extends Component {
  12. constructor(props) {
  13. super(props);
  14. this.state = {
  15. id: "",
  16. messageInfo: {
  17. createTime: "",
  18. notificationText: "",
  19. notificationTitle: "",
  20. notificationType: ""
  21. }
  22. };
  23. }
  24. componentDidMount() {
  25. if (this.props.route?.params?.id) {
  26. this.setState({
  27. id: this.props.route?.params?.id
  28. }, () => {
  29. this.readMessage();
  30. })
  31. }
  32. }
  33. readMessage() {
  34. Dialog.showProgressDialog();
  35. apiNotification.readMessage(this.state.id).then(res => {
  36. if (res.data) {
  37. this.setState({
  38. messageInfo: res.data
  39. });
  40. }
  41. }).catch(err => {
  42. toastShort(err);
  43. }).finally(() => {
  44. Dialog.dismissLoading();
  45. })
  46. }
  47. submitFeedback() {
  48. startPage(PageList.feedback);
  49. }
  50. render() {
  51. return (
  52. <View style={styles.container}>
  53. <ScrollView
  54. style={ui.flex1}
  55. contentContainerStyle={styles.content}
  56. stickyHeaderIndices={[1]}>
  57. <Image
  58. style={styles.topImage}
  59. resizeMode="cover"
  60. />
  61. <View style={styles.header}>
  62. <Text
  63. style={styles.textTitle}>
  64. {this.state.messageInfo.notificationTitle}
  65. </Text>
  66. <Text
  67. style={styles.textDate}
  68. numberOfLines={1}>
  69. {this.state.messageInfo.createTime}
  70. </Text>
  71. </View>
  72. <Text
  73. style={styles.textMessage}>
  74. {this.state.messageInfo.notificationText}
  75. </Text>
  76. </ScrollView>
  77. </View>
  78. );
  79. }
  80. }
  81. const styles = StyleSheet.create({
  82. container: {
  83. flex: 1,
  84. backgroundColor: pageBackground
  85. },
  86. textTitle: {
  87. color: textPrimary,
  88. fontSize: 18,
  89. fontWeight: 'bold'
  90. },
  91. textDate: {
  92. color: textSecondary,
  93. fontSize: 10,
  94. paddingTop: 1
  95. },
  96. topImage: {
  97. width: $vw(100),
  98. height: $vw(80),
  99. backgroundColor: "#F0F0F0"
  100. },
  101. header: {
  102. padding: 16,
  103. backgroundColor: pageBackground
  104. },
  105. content: {
  106. backgroundColor: pageBackground
  107. },
  108. textMessage: {
  109. color: textPrimary,
  110. fontSize: 14,
  111. padding: 16,
  112. }
  113. })