messageSystem.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="messageSys">
  3. <statusBar :item="navBarData"></statusBar>
  4. <scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollview" :style="{height:(screenHeight - navheight)+'px' }">
  5. <view class="reverse" id="msglistview">
  6. <view class="content" v-for="(item,index) in list" :key="index">
  7. <view class="conblock">
  8. <view class="header">
  9. <view class="disC three-font">
  10. 成功加入[{{item.acName}}]{{item.type>=2?'教研室':'活动'}}
  11. </view>
  12. </view>
  13. <view class="sj fwb-font">{{item.create_at}}</view>
  14. <view class="main">
  15. <view class="fwb-font">
  16. 尊敬的
  17. <text>{{item.username}}</text>
  18. </view>
  19. <view class="fwb-font" style="text-indent: 2em;">
  20. 我们很高兴通知您,您已成功加入
  21. <text class="btn-font" style="color: #0056a8;">[{{item.acName}}]</text>
  22. !欢迎加入我们的团队,我们期待与您一同合作并共同追求卓越教育。
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. navBarData: {
  36. title: '系统消息',
  37. btn: 1
  38. },
  39. newsLoading: 0, //0默认值 1加载中 2没有更多了
  40. currentPage: 1,
  41. navheight: this.navheight, //导航栏高度
  42. scrollTop: 0,
  43. // 渲染列表
  44. list: [],
  45. };
  46. },
  47. methods: {
  48. // 获取数据
  49. getdata() {
  50. let data = {
  51. oid: this.$store.state.user.openid, //用户id
  52. type: 1,
  53. page: this.currentPage,
  54. lim: 30
  55. }
  56. this.$request('/selectMessage', "POST", data).then(res => {
  57. // console.log('获取', res[0]);
  58. // this.list = [this.list,...res[0]]
  59. this.list = res[0]
  60. // console.log('获取',this.list);
  61. })
  62. },
  63. updateisread() {
  64. let data = {
  65. oid: this.$store.state.user.openid, //用户id
  66. type: 1,
  67. }
  68. this.$request('/updateIsRead', "POST", data).then(res => {
  69. // console.log('获取', res);
  70. })
  71. },
  72. // 聊天记录自动跳转底部
  73. scrollToBottom() {
  74. let that = this
  75. let query = uni.createSelectorQuery()
  76. query.select('#scrollview').boundingClientRect()
  77. query.select('#msglistview').boundingClientRect()
  78. query.exec((res) => {
  79. // console.log('res', res);
  80. console.log('res',res[1].height, res[0].height);
  81. // console.log(res[1].height, res[0].height);
  82. if (res[1].height > res[0].height) {
  83. that.scrollTop = res[1].height - res[0].height
  84. }
  85. })
  86. }
  87. },
  88. onShow() {
  89. // 获取页面数据
  90. this.getdata()
  91. // 更新已读
  92. this.updateisread()
  93. },
  94. // 进入页面渲染完毕后调用
  95. onReady() {
  96. this.scrollToBottom()
  97. },
  98. onLoad() {
  99. // this.userName = this.$store.state.user.userName
  100. // this.getdata()
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .classTest {
  106. font-size: 30px;
  107. }
  108. .messageSys {
  109. padding-bottom: 80rpx;
  110. }
  111. .reverse {
  112. // flex: 1;
  113. display: flex;
  114. flex-direction: column-reverse;
  115. .content {
  116. padding: 10px;
  117. margin: 10px;
  118. background-color: white;
  119. border-radius: 8px;
  120. .conblock {
  121. .header {
  122. color: black;
  123. font-weight: 600;
  124. display: flex;
  125. justify-content: space-between;
  126. .disC {
  127. display: flex;
  128. width: 100%;
  129. font-weight: bold;
  130. justify-content: space-between;
  131. align-items: baseline;
  132. /*隐藏溢出*/
  133. /*当文本溢出包含元素时显示省略符号来代表被修剪的文本*/
  134. /*规定段落中的文本不进行换行*/
  135. white-space: normal;
  136. letter-spacing: 2rpx;
  137. display: -webkit-box;
  138. word-break: break-all;
  139. text-overflow: ellipsis;
  140. overflow: hidden;
  141. -webkit-box-orient: vertical;
  142. -webkit-line-clamp: 2;
  143. /*设置 需要显示的行数*/
  144. }
  145. }
  146. .sj {
  147. color: #999999;
  148. font-weight: 500;
  149. padding: 10rpx 0;
  150. }
  151. .main {
  152. color: #999999;
  153. view {
  154. font-weight: 400;
  155. // font-size: 14px;
  156. view {
  157. color: #0056a8;
  158. font-weight: 600;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>