groupMemlist.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="page">
  3. <view class="bcenter">
  4. <view class="avator" v-for="(item, index) in list" :key="index" @click="actMenu(item.userID)">
  5. <image :src="item.avator" mode="aspectFill" />
  6. <text>{{item.nick}}</text>
  7. <image v-if="is_del" class="delit" src="../../static/icon/del_mem.png">
  8. </image>
  9. </view>
  10. <view class="avator" @click="addMember">
  11. <image src="../../static/icon/icon_add.png" mode="widthFix" />
  12. <text></text>
  13. </view>
  14. <!-- <view class="avator" @click="delMember">
  15. <image src="../../static/icon/icon_del.png" mode="widthFix" />
  16. <text></text>
  17. </view> -->
  18. </view>
  19. <ToastW3 ref="ToastW3"></ToastW3>
  20. <DialogBox ref="DialogBox"></DialogBox>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. components: {},
  26. data() {
  27. return {
  28. page: 1,
  29. list: [],
  30. num_total: 0,
  31. groupId: '',
  32. hasMore: true,
  33. name: '',
  34. is_del: false,
  35. isManage: 0,
  36. }
  37. },
  38. onLoad(parms) {
  39. let self = this;
  40. this.groupId = parms.groupId || "1"
  41. },
  42. onShow() {
  43. this.loadData();
  44. },
  45. methods: {
  46. delMember() {
  47. if (this.is_del) {
  48. this.is_del = false;
  49. } else {
  50. this.is_del = true;
  51. }
  52. },
  53. addMember() {
  54. uni.navigateTo({
  55. url: '/pages/chat/addMem?groupId=' + this.groupId
  56. })
  57. },
  58. loadData() {
  59. // this.groupID = 1;
  60. this.page = 1;
  61. this.hasMore = true;
  62. // let res = await this.TIM.getGroupMemberList(id, this.page)
  63. // this.list = res.data.memberList;
  64. let that = this;
  65. // var offset = (this.page - 1) * 20;
  66. uni.request({
  67. url: this.$apiHost2 + '/Chat/groupMembers', //仅为示例,并非真实接口地址。
  68. data: {
  69. uuid: getApp().globalData.uuid,
  70. groupId: this.groupId,
  71. getall: 1
  72. },
  73. header: {
  74. 'content-type': 'application/json' //自定义请求头信息
  75. },
  76. success: (res) => {
  77. console.log("----", res.data);
  78. if (res.data.list == undefined || res.data.list == null) {
  79. res.data.list = []
  80. }
  81. this.isManage = res.data.isManage;
  82. if (that.page > 1) {
  83. that.list = that.list.concat(res.data.list)
  84. } else {
  85. that.list = res.data.list;
  86. }
  87. that.num_total = res.data.total;
  88. }
  89. });
  90. },
  91. actMenu(uid) {
  92. let that = this;
  93. uni.showActionSheet({
  94. title: '',
  95. itemList: ['禁言', '移除'],
  96. success: function(res) {
  97. if (res.tapIndex == 0) {
  98. that.actMem('lock', uid);
  99. } else {
  100. that.actMem('del', uid);
  101. }
  102. },
  103. fail: function(res) {
  104. console.log(res.errMsg);
  105. }
  106. });
  107. },
  108. actMem(act, uid) {
  109. let tips = '确定禁言吗?';
  110. if (act == 'del') {
  111. tips = '您确认删除吗?';
  112. }
  113. let that = this;
  114. this.$refs['DialogBox'].confirm({
  115. title: '提示',
  116. content: tips,
  117. DialogType: 'inquiry',
  118. btn1: '否',
  119. btn2: '是',
  120. animation: 0
  121. }).then((res) => {
  122. uni.showLoading({})
  123. uni.request({
  124. url: that.$apiHost2 + '/Chat/groupActMem', //仅为示例,并非真实接口地址。
  125. data: {
  126. uuid: getApp().globalData.uuid,
  127. groupId: that.groupId,
  128. userId: uid,
  129. act: act
  130. },
  131. header: {
  132. 'content-type': 'application/json' //自定义请求头信息
  133. },
  134. success: (res) => {
  135. console.log("----", res.data);
  136. that.$refs['ToastW3'].showToast({
  137. title: res.data.str,
  138. animation: 0
  139. });
  140. if (res.data.success == "yes") {
  141. this.loadData();
  142. }
  143. },
  144. complete: (com) => {
  145. uni.hideLoading();
  146. },
  147. });
  148. })
  149. },
  150. }
  151. }
  152. </script>
  153. <style scoped lang="scss">
  154. @import 'groupMemlist.scss';
  155. </style>