informationInfo.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <!-- 测试 -->
  2. <template>
  3. <view id="informationInfo">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="for-info-box" v-for="(item,index) in infoList" :key="index">
  6. <view class="title-time">{{item.createTime}}</view>
  7. <view class="for-min-box">
  8. <view>通知</view>
  9. <rich-text :nodes="item.meaasgeContext"></rich-text>
  10. </view>
  11. </view>
  12. <!-- <view class="for-info-box" v-if="itemData.isApply==-1">
  13. <view class="title-time">{{itemData.deptName}}</view>
  14. <view class="for-min-box">
  15. <view>通知</view>
  16. <rich-text :nodes="itemData.newMessage"></rich-text>
  17. </view>
  18. </view> -->
  19. <view class="get-null-box" v-if="getData.nullDataType &&itemData.isApply!=-1">暂无更多数据</view>
  20. </scroll-view>
  21. </view>
  22. </template>
  23. <script>
  24. import { groupIdList,groupListRead} from '@/api/apiDemo/index.js'
  25. export default {
  26. data() {
  27. return {
  28. //列表请求参数
  29. getData:{
  30. page:1,
  31. pageSize:20,
  32. getType:true,
  33. nullDataType:true,
  34. },
  35. itemData:{},
  36. infoList:[]
  37. }
  38. },
  39. onLoad(option) {
  40. this.itemData = JSON.parse(decodeURIComponent(option.item));
  41. //修改页面title
  42. if(this.itemData.sendUserId == '-2'){
  43. uni.setNavigationBarTitle({
  44. title:this.itemData.sendName
  45. });
  46. }else if(this.itemData.isApply==-1){
  47. this.getRead()
  48. }else{
  49. uni.setNavigationBarTitle({
  50. title:this.itemData.sendName+'-'+this.itemData.deptName
  51. });
  52. }
  53. this.getList();
  54. },
  55. methods: {
  56. //清除
  57. clearData(){
  58. this.infoList = [];
  59. this.getData.page = 1;
  60. this.getData.getType = true;
  61. this.getData.nullDataType = true;
  62. },
  63. //滚动事件
  64. scrollGet(){
  65. if(this.getData.getType){
  66. this.getData.page += 1;
  67. this.getList();
  68. }
  69. },
  70. async getRead() {
  71. let self = this;
  72. const {data} = await groupListRead({messageId:this.itemData.messageId})
  73. if(data.code==200){
  74. }
  75. },
  76. //获取列表数据
  77. async getList(){
  78. let self = this;
  79. let obj = {
  80. pageNum:this.getData.page,
  81. pageSize:this.getData.pageSize,
  82. };
  83. const {data} = await groupIdList(this.itemData.sendUserId,obj);
  84. if(data.code==200){
  85. let newDataList = data.rows;
  86. for(let i=0;i<newDataList.length;i++){
  87. let list = [];
  88. if(!newDataList[i].createTime || newDataList[i].createTime == null){
  89. newDataList[i].createTime = '';
  90. }else{
  91. list = newDataList[i].createTime.split(' ');
  92. newDataList[i].createTime = list[0];
  93. }
  94. newDataList[i].meaasgeContext = unescape(newDataList[i].meaasgeContext);
  95. newDataList[i].meaasgeContext = newDataList[i].meaasgeContext.replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<p')
  96. .replace(/<p>/ig, '<p style="font-size: 15px; line-height: 25px;">')
  97. .replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, '<img$1')
  98. .replace(/<img([\s\w"-=\/\.:;]+)((?:(width="[^"]+")))/ig, '<img$1')
  99. .replace(/<img([\s\w"-=\/\.:;]+)((?:(style="[^"]+")))/ig, '<img$1')
  100. .replace(/<img([\s\w"-=\/\.:;]+)((?:(alt="[^"]+")))/ig, '<img$1')
  101. .replace(/<img([\s\w"-=\/\.:;]+)/ig, '<img style="width: 100%;" $1');
  102. }
  103. if(self.page==1){
  104. if(newDataList.length > 0 && newDataList.length == self.getData.pageSize){
  105. self.infoList = newDataList;
  106. }else if(newDataList.length > 0 && newDataList.length != self.getData.pageSize){
  107. self.infoList = newDataList;
  108. self.getData.getType = false;
  109. self.getData.nullDataType = true;
  110. }else{
  111. self.getData.getType = false;
  112. self.getData.nullDataType = true;
  113. }
  114. }else{
  115. if(newDataList.length > 0 && newDataList.length == self.getData.pageSize){
  116. self.infoList = self.infoList.concat(newDataList)
  117. }else if(newDataList.length > 0 && newDataList.length != self.getData.pageSize){
  118. self.infoList = self.infoList.concat(newDataList);
  119. self.getData.getType = false;
  120. self.getData.nullDataType = true;
  121. }else{
  122. self.getData.getType = false;
  123. self.getData.nullDataType = true;
  124. }
  125. }
  126. }
  127. },
  128. formatDate(date) {
  129. let newDate = new Date(date);
  130. let YY = newDate.getFullYear() + '-';
  131. let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
  132. let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
  133. return YY + MM + DD;
  134. },
  135. }
  136. }
  137. </script>
  138. <style lang="stylus" scoped>
  139. #informationInfo{
  140. height:100%;
  141. display flex
  142. .info-max-box{
  143. flex:1;
  144. overflow: scroll
  145. background #f5f5f5;
  146. padding-bottom:20px;
  147. .for-info-box{
  148. border-radius: 10rpx;
  149. .title-time{
  150. line-height:94rpx;
  151. color:#CCCCCC;
  152. text-align: center;
  153. font-size: 24rpx;
  154. }
  155. .for-min-box{
  156. background #ffffff
  157. border-radius:10rpx;
  158. padding:20rpx;
  159. margin:0 20rpx;
  160. view:nth-child(1){
  161. line-height:44rpx;
  162. margin-bottom:13rpx;
  163. margin-left:5rpx;
  164. color: #333333;
  165. font-size: 30rpx;
  166. }
  167. view:nth-child(2){
  168. line-height:42rpx;
  169. font-size: 25rpx;
  170. color: #666;
  171. }
  172. img{
  173. width:100%;
  174. height:100%;
  175. max-width 100%;
  176. }
  177. rich-text{
  178. overflow hidden
  179. }
  180. }
  181. }
  182. .get-null-box{
  183. height:100rpx;
  184. line-height:100rpx;
  185. color:#999;
  186. text-align center
  187. }
  188. }
  189. }
  190. </style>