member.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <uni-popup ref="popup" type="bottom">
  3. <view class="main">
  4. <view class="top" @click="closeTA">
  5. <image src="../../../static/me/close2.png"></image>
  6. </view>
  7. <view class="bcenter">
  8. <view class="avator" v-for="(item, index) in list" :key="index">
  9. <image src="https://e.yujianmate.com/images/avator/a1.jpg" mode="widthFix" />
  10. <text>{{item.nick}}</text>
  11. </view>
  12. <view class="avator" @click="selAvator('a2.jpg')">
  13. <image src="../../../static/icon/my-icon-6.png" mode="widthFix" />
  14. <text></text>
  15. </view>
  16. <view class="avator" @click="selAvator('a3.jpg')">
  17. <image src="../../../static/icon/my-icon-4.png" mode="widthFix" />
  18. <text></text>
  19. </view>
  20. </view>
  21. <view class="viewMore" @click="viewMore">查看更多群成员&raquo;</view>
  22. <view class="line"></view>
  23. <view class="list_info">
  24. <view class="item">
  25. <text>群聊名称</text>
  26. <input type="text" class="input" v-model="name" placeholder="请输入新的名称" maxlength="11" />
  27. </view>
  28. <view class="item">
  29. <text>全体禁言</text>
  30. <switch color="#FFCC33" style="transform:scale(0.7)" />
  31. </view>
  32. <view class="blankHeight"></view>
  33. </view>
  34. <view class="line"></view>
  35. <view class="submitLogout">退出群聊/解散群聊</view>
  36. <scroll-view scroll-y="true" class="list" @scrolltolower="loadMore" v-if="false">
  37. <view class="text">群成员列表(总成员:{{num_total}})</view>
  38. <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item.userID)">
  39. <view class="left">
  40. <view class="avatorImg2">{{item.ava_name}}</view>
  41. <!-- <image class="avatar" lazy-load="true" :src="item.avatar"></image> -->
  42. <view class="nick">{{item.nick}}</view>
  43. <!-- <image class="gender" v-if="item.gender == 2" src="@/static/icon/woman.png" mode="aspectFill" />
  44. <image class="gender" v-if="item.gender == 1" src="@/static/icon/man.png" mode="aspectFill" /> -->
  45. </view>
  46. <image v-if="true" class="hi" src="@/static/images/article/dazhaohu_2.png" mode="aspectFill"
  47. @click="navigateToChatDetail(item.userID, item.nick)" />
  48. </view>
  49. </scroll-view>
  50. </view>
  51. </uni-popup>
  52. </template>
  53. <script>
  54. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  55. export default {
  56. components: {
  57. uniPopup
  58. },
  59. data() {
  60. return {
  61. page: 1,
  62. list: [],
  63. num_total: 0,
  64. groupID: "",
  65. hasMore: true,
  66. name: '',
  67. }
  68. },
  69. methods: {
  70. closeTA() {
  71. // this.$refs.member.open(this.userID);
  72. this.$refs.popup.close();
  73. },
  74. viewMore() {
  75. },
  76. async open(id) {
  77. this.groupID = id;
  78. this.page = 1;
  79. this.hasMore = true;
  80. this.$refs.popup.open();
  81. // let res = await this.TIM.getGroupMemberList(id, this.page)
  82. // this.list = res.data.memberList;
  83. let that = this;
  84. var offset = (this.page - 1) * 20;
  85. uni.request({
  86. url: this.$apiHost2 + '/Chat/groupMembers', //仅为示例,并非真实接口地址。
  87. data: {
  88. skey: getApp().globalData.skey,
  89. groupId: id,
  90. offset: offset
  91. },
  92. header: {
  93. 'content-type': 'application/json' //自定义请求头信息
  94. },
  95. success: (res) => {
  96. console.log("----", res.data);
  97. if (res.data.list == undefined || res.data.list == null) {
  98. res.data.list = []
  99. }
  100. if (that.page > 1) {
  101. that.list = that.list.concat(res.data.list)
  102. } else {
  103. that.list = res.data.list;
  104. }
  105. that.num_total = res.data.total;
  106. }
  107. });
  108. },
  109. async loadMore() {
  110. console.log('loadMore');
  111. if (!this.hasMore) {
  112. return
  113. }
  114. this.page = this.page + 1;
  115. let that = this;
  116. var offset = (this.page - 1) * 20;
  117. uni.request({
  118. url: this.$apiHost2 + '/Chat/groupMembers', //仅为示例,并非真实接口地址。
  119. data: {
  120. skey: getApp().globalData.skey,
  121. groupId: that.groupID,
  122. offset: offset
  123. },
  124. header: {
  125. 'content-type': 'application/json' //自定义请求头信息
  126. },
  127. success: (res) => {
  128. console.log("----", res.data);
  129. if (res.data.list == undefined || res.data.list == null) {
  130. res.data.list = [];
  131. }
  132. if (that.page > 1) {
  133. that.list = that.list.concat(res.data.list)
  134. }
  135. if (res.data.list.length == 0) {
  136. that.hasMore = false;
  137. }
  138. }
  139. });
  140. // let res = await this.TIM.getGroupMemberList(this.groupID, this.page)
  141. // if (res.data.memberList.length == 0) {
  142. // this.hasMore = false
  143. // }
  144. // this.list = this.list.concat(res.data.memberList)
  145. },
  146. toDetail(uid) {
  147. // uni.navigateTo({
  148. // url: "/pages/detail/index?uid=" + uid,
  149. // });
  150. },
  151. navigateToChatDetail(userID, nickName) {
  152. if (true) {
  153. return;
  154. }
  155. let jsonUserID = encodeURIComponent(JSON.stringify(userID));
  156. let jsonNickName = encodeURIComponent(JSON.stringify(nickName));
  157. let jsonConversationID = encodeURIComponent(JSON.stringify("C2C" + userID));
  158. let jsonConversationType = encodeURIComponent(JSON.stringify("C2C"));
  159. uni.navigateTo({
  160. url: "/pages/chat/detail?userID=" + jsonUserID + "&nickName=" + jsonNickName +
  161. "&conversationID=" + jsonConversationID + "&conversationType=" + jsonConversationType
  162. })
  163. },
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .main {
  169. height: 100vh;
  170. padding: 0rpx 0rpx;
  171. background: #f0f0f0;
  172. }
  173. .top {
  174. width: 100%;
  175. background-color: #fff;
  176. display: flex;
  177. flex-direction: row;
  178. justify-content: flex-end;
  179. align-items: flex-end;
  180. padding-right: 30rpx;
  181. padding-top: 20rpx;
  182. image {
  183. width: 38rpx;
  184. height: 38rpx;
  185. }
  186. }
  187. .text {}
  188. .list {
  189. height: 86vh;
  190. .item {
  191. display: flex;
  192. justify-content: space-between;
  193. align-items: center;
  194. margin-bottom: 20rpx;
  195. padding-bottom: 10rpx;
  196. border-bottom: dotted 1px #f0f0f0;
  197. .left {
  198. display: flex;
  199. align-items: center;
  200. .avatorImg2 {
  201. width: 90rpx;
  202. height: 90rpx;
  203. background-color: #d4237a;
  204. border-radius: 50%;
  205. display: flex;
  206. justify-content: center;
  207. align-items: center;
  208. color: #fff;
  209. font-weight: bold;
  210. font-size: 40rpx;
  211. }
  212. .nick {
  213. margin-left: 20rpx;
  214. }
  215. .avatar {
  216. border-radius: 100%;
  217. width: 75rpx;
  218. height: 75rpx;
  219. }
  220. .gender {
  221. margin-left: 20rpx;
  222. width: 30rpx;
  223. height: 30rpx;
  224. }
  225. }
  226. .hi {
  227. width: 45rpx;
  228. height: 45rpx;
  229. }
  230. }
  231. }
  232. .list_info {
  233. display: flex;
  234. flex-direction: column;
  235. justify-content: flex-start;
  236. align-items: center;
  237. color: #fff;
  238. background-color: #fff;
  239. width: 100%;
  240. .item {
  241. width: 690rpx;
  242. height: 84rpx;
  243. margin-top: 10rpx;
  244. color: #000;
  245. font-size: 28rpx;
  246. display: flex;
  247. flex-direction: row;
  248. justify-content: space-between;
  249. align-items: center;
  250. text {}
  251. input {
  252. text-align: right;
  253. }
  254. .arrow {
  255. width: 36rpx;
  256. }
  257. .desc {
  258. color: #333;
  259. }
  260. }
  261. }
  262. .title {}
  263. .bcenter {
  264. display: flex;
  265. align-items: center;
  266. padding-top: 20rpx;
  267. padding-left: 30rpx;
  268. background-color: #fff;
  269. flex-wrap: wrap;
  270. .avator {
  271. width: 132rpx;
  272. position: relative;
  273. display: flex;
  274. flex-direction: column;
  275. justify-content: center;
  276. align-items: center;
  277. font-size: 22rpx;
  278. padding-bottom: 12rpx;
  279. image {
  280. border-radius: 100rpx;
  281. width: 80rpx;
  282. height: 80rpx;
  283. }
  284. text {
  285. height: 30rpx;
  286. }
  287. }
  288. .active {
  289. image {
  290. border-radius: 100rpx;
  291. border: solid 4rpx #FF2A95;
  292. border-radius: 100rpx;
  293. }
  294. }
  295. }
  296. .line {
  297. width: 750rpx;
  298. height: 8rpx;
  299. background-color: #f0f0f0;
  300. }
  301. .viewMore {
  302. width: 750rpx;
  303. height: 70rpx;
  304. background-color: #fff;
  305. text-align: center;
  306. line-height: 70rpx;
  307. font-size: 24rpx;
  308. }
  309. .submitLogout {
  310. width: 750rpx;
  311. height: 96rpx;
  312. position: fixed;
  313. bottom: 0;
  314. left: 0;
  315. font-size: 26rpx;
  316. background-color: #fff;
  317. color: #FF2A95;
  318. display: flex;
  319. flex-direction: row;
  320. justify-content: center;
  321. align-items: center;
  322. }
  323. .blankHeight {
  324. height: 30rpx;
  325. }
  326. </style>