Campaign.js 2.6 KB

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