chat-group-apply.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="page">
  3. <uni-list v-if="friend_apply_list.length">
  4. <view v-for="(value,key) in friend_apply_list" :key="key">
  5. <view class="uni-media-list btm_border">
  6. <view class="uni-media-list-logo">
  7. <image :src="staticPhoto + value.photo" class="img-icon" />
  8. </view>
  9. <view class="uni-media-list-body">
  10. <view class="uni-list-cell-navigate">{{value.nickname}}</view>
  11. <view class="uni-list-cell-navigate content">{{value.content}}</view>
  12. </view>
  13. <view style="position: relative;">
  14. <block v-if="value.status == 0">
  15. <view class="badge-text"
  16. style="background-color:#09BB07;color:#FFFFFF;position:absolute;top: 20upx;right: 0;width:50upx;text-align: center;"
  17. @tap="groupAdd(value.id + '')"
  18. >
  19. <text>接受</text>
  20. </view>
  21. </block>
  22. <block v-else>
  23. <view class="badge-text"
  24. style="background-color:#f1f1f1;color:#333;position:absolute;top: 20upx;right: 0;width:80upx;text-align: center;"
  25. >
  26. <text>{{value.text}}</text>
  27. </view>
  28. </block>
  29. </view>
  30. </view>
  31. </view>
  32. </uni-list>
  33. <uni-load-more status="noMore" v-if="noMore"/>
  34. </view>
  35. </template>
  36. <script>
  37. import uniList from '../../components/uni-ui/uni-list/uni-list.vue';
  38. import uniListItem from '../../components/uni-ui/uni-list-item/uni-list-item.vue';
  39. import uniLoadMore from "../../components/uni-ui/uni-load-more/uni-load-more.vue";
  40. import _get from '../../common/_get';
  41. import _hook from '../../common/_hook';
  42. import _data from '../../common/_data';
  43. export default {
  44. components: {
  45. uniList,
  46. uniListItem,
  47. uniLoadMore,
  48. },
  49. data() {
  50. return {
  51. noMore: 0,
  52. friend_apply_list: [],
  53. }
  54. },
  55. onShow(){
  56. _hook.routeSonHook();
  57. let friend_apply_list = _data.localData('group_apply_list'),
  58. _this = this;
  59. /** 监听最新数据 */
  60. uni.$on('data_group_apply_data',function(data){
  61. _this.friend_apply_list = data;
  62. });
  63. /** 加载本地缓存数据,如果有新的朋友申请,更新本地数据 */
  64. if(friend_apply_list && _this.action == 0){
  65. _this.friend_apply_list = friend_apply_list;
  66. }else{
  67. _get.getGroupApplyList((data) => {
  68. if(data.length < 1){
  69. _this.noMore = 1;
  70. }
  71. });
  72. }
  73. },
  74. onLoad() {
  75. },
  76. onUnload(){
  77. uni.$off('data_group_apply_list');
  78. },
  79. computed: {
  80. staticPhoto(){
  81. return _data.staticPhoto();
  82. },
  83. },
  84. methods: {
  85. groupAdd(id){
  86. let _this = this;
  87. if(id){
  88. _this.$httpSend({
  89. path: '/im/message/addGroupAllow',
  90. data: { id },
  91. });
  92. }
  93. }
  94. },
  95. watch: {
  96. },
  97. }
  98. </script>
  99. <style>
  100. .img-icon{
  101. width:90upx;
  102. height: 90upx;
  103. border-radius: 10upx;
  104. }
  105. .uni-list-cell-navigate {
  106. padding: 0;
  107. }
  108. .content{
  109. color:#7D7D72;
  110. font-size: 28upx;
  111. }
  112. .badge-text{
  113. background-color: #EEEEEE;
  114. padding: 3upx 10upx 0 10upx;
  115. border-radius: 15upx;
  116. font-size: 22upx;
  117. }
  118. .btm_border{
  119. border-bottom: solid 1upx #E7E7E7 ;
  120. }
  121. </style>