groupSetting.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view class="page">
  3. <block v-if="have_chk > 0">
  4. <view class="viewMore">
  5. 申请待审核
  6. <image src="../../static/me/arrow_down_gray.png" mode="widthFix" />
  7. </view>
  8. <view class="bcenter">
  9. <view class="avator" v-for="(item, index) in list0" :key="index" @click="actMenuC(item.userID)">
  10. <image :src="item.avator" mode="aspectFill" />
  11. <text>{{item.nick}}</text>
  12. </view>
  13. </view>
  14. <view class="line"></view>
  15. <view class="line"></view>
  16. <view class="line"></view>
  17. </block>
  18. <view class="bcenter">
  19. <view class="avator" v-for="(item, index) in list" :key="index" @click="actMenu(item.userID)">
  20. <image :src="item.avator" mode="aspectFill" />
  21. <text>{{item.nick}}</text>
  22. <image v-if="is_del" class="delit" src="../../static/icon/del_mem.png">
  23. </image>
  24. </view>
  25. <view class="avator" @click="addMember">
  26. <image src="../../static/icon/icon_add.png" mode="widthFix" />
  27. <text></text>
  28. </view>
  29. <!-- <view class="avator" @click="delMember">
  30. <image src="../../static/icon/icon_del.png" mode="widthFix" />
  31. <text></text>
  32. </view> -->
  33. </view>
  34. <view class="viewMore" @click="viewMore">
  35. 更多群成员
  36. <image src="../../static/me/arrow_down_gray.png" mode="widthFix" />
  37. </view>
  38. <view class="line"></view>
  39. <view class="list_info">
  40. <view class="item">
  41. <text>群聊名称</text>
  42. <view class="right" @click="editName">
  43. <text>{{name}}</text>
  44. <image src="../../static/me/arrow_right_gray.png" mode="widthFix" />
  45. </view>
  46. </view>
  47. <view class="item">
  48. <text>全体禁言</text>
  49. <switch color="#FF2A95" style="transform:scale(0.7);" v-if="is_lock == 0" @change="LockGroup(1)" />
  50. <switch checked color="#FF2A95" style="transform:scale(0.7);" v-else @change="LockGroup(0)" />
  51. </view>
  52. <view class="blankHeight"></view>
  53. </view>
  54. <view class="line"></view>
  55. <view class="submitLogout" @click="actMem('remove',0)" v-if="isManage == 0">退出群聊</view>
  56. <view class="submitLogout" @click="actMem('remove',0)" v-if="isManage == 1">解散群聊</view>
  57. <view class="thread2"></view>
  58. <view class="thread2"></view>
  59. <ToastW3 ref="ToastW3"></ToastW3>
  60. <DialogBox ref="DialogBox"></DialogBox>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. components: {},
  66. data() {
  67. return {
  68. page: 1,
  69. have_chk: 0,
  70. list0: [],
  71. list: [],
  72. num_total: 0,
  73. groupId: '',
  74. hasMore: true,
  75. name: '',
  76. is_lock: 0,
  77. is_del: false,
  78. isManage: 0,
  79. info: {}
  80. }
  81. },
  82. onLoad(parms) {
  83. let self = this;
  84. this.groupId = parms.groupId || "1"
  85. },
  86. onShow() {
  87. this.loadData();
  88. },
  89. methods: {
  90. delMember() {
  91. if (this.is_del) {
  92. this.is_del = false;
  93. } else {
  94. this.is_del = true;
  95. }
  96. },
  97. addMember() {
  98. uni.navigateTo({
  99. url: '/pages/chat/addMem?groupId=' + this.groupId
  100. })
  101. },
  102. viewMore() {
  103. uni.navigateTo({
  104. url: '/pages/chat/groupMemlist?groupId=' + this.groupId
  105. })
  106. },
  107. loadData() {
  108. // this.groupID = 1;
  109. this.page = 1;
  110. this.hasMore = true;
  111. // let res = await this.TIM.getGroupMemberList(id, this.page)
  112. // this.list = res.data.memberList;
  113. let that = this;
  114. var offset = (this.page - 1) * 20;
  115. uni.request({
  116. url: this.$apiHost2 + '/Chat/groupMembers', //仅为示例,并非真实接口地址。
  117. data: {
  118. uuid: getApp().globalData.uuid,
  119. groupId: this.groupId,
  120. offset: offset
  121. },
  122. header: {
  123. 'content-type': 'application/json' //自定义请求头信息
  124. },
  125. success: (res) => {
  126. console.log("----", res.data);
  127. if (res.data.list == undefined || res.data.list == null) {
  128. res.data.list = []
  129. }
  130. this.have_chk = 0;
  131. if (res.data.list0 != undefined && res.data.list0 != null) {
  132. if (res.data.list0.length > 0) {
  133. this.list0 = res.data.list0;
  134. this.have_chk = 1;
  135. }
  136. }
  137. this.isManage = res.data.isManage;
  138. if (that.page > 1) {
  139. that.list = that.list.concat(res.data.list)
  140. } else {
  141. that.list = res.data.list;
  142. }
  143. that.name = res.data.name;
  144. that.is_lock = res.data.is_lock;
  145. that.num_total = res.data.total;
  146. }
  147. });
  148. },
  149. actMem(act, uid) {
  150. let that = this;
  151. this.$refs['DialogBox'].confirm({
  152. title: '提示',
  153. content: '请再次确认是否执行',
  154. DialogType: 'inquiry',
  155. btn1: '否',
  156. btn2: '是',
  157. animation: 0
  158. }).then((res) => {
  159. uni.showLoading({})
  160. uni.request({
  161. url: that.$apiHost2 + '/Chat/groupActMem', //仅为示例,并非真实接口地址。
  162. data: {
  163. uuid: getApp().globalData.uuid,
  164. groupId: that.groupId,
  165. userId: uid,
  166. act: act
  167. },
  168. header: {
  169. 'content-type': 'application/json' //自定义请求头信息
  170. },
  171. success: (res) => {
  172. console.log("----", res.data);
  173. that.$refs['ToastW3'].showToast({
  174. title: res.data.str,
  175. animation: 0
  176. });
  177. if (res.data.success == "yes") {
  178. this.loadData();
  179. }
  180. },
  181. complete: (com) => {
  182. uni.hideLoading();
  183. },
  184. });
  185. })
  186. },
  187. LockGroup(lock) {
  188. let that = this;
  189. uni.showLoading({})
  190. uni.request({
  191. url: that.$apiHost2 + '/Chat/groupActMem', //仅为示例,并非真实接口地址。
  192. data: {
  193. uuid: getApp().globalData.uuid,
  194. groupId: that.groupId,
  195. lock: lock,
  196. act: "lockGroup"
  197. },
  198. header: {
  199. 'content-type': 'application/json' //自定义请求头信息
  200. },
  201. success: (res) => {
  202. console.log("----", res.data);
  203. that.$refs['ToastW3'].showToast({
  204. title: res.data.str,
  205. animation: 0
  206. });
  207. },
  208. complete: (com) => {
  209. uni.hideLoading();
  210. },
  211. });
  212. },
  213. editName() {
  214. let that = this;
  215. this.$refs['DialogBox'].confirm({
  216. title: '请谨慎修改',
  217. placeholder: '请输入新的群名称',
  218. Infinity: true,
  219. DialogType: 'input',
  220. btn1: '取消',
  221. btn2: '确定',
  222. animation: 0
  223. }).then((res) => {
  224. uni.showLoading({})
  225. uni.request({
  226. url: that.$apiHost2 + '/Chat/groupActMem',
  227. data: {
  228. uuid: getApp().globalData.uuid,
  229. groupId: that.groupId,
  230. name: res.value,
  231. act: "editName"
  232. },
  233. header: {
  234. 'content-type': 'application/json' //自定义请求头信息
  235. },
  236. success: (res) => {
  237. console.log("----", res.data);
  238. that.$refs['ToastW3'].showToast({
  239. title: res.data.str,
  240. animation: 0
  241. });
  242. if (res.data.success == "yes") {
  243. this.loadData();
  244. }
  245. },
  246. complete: (com) => {
  247. uni.hideLoading();
  248. },
  249. });
  250. })
  251. },
  252. actMenuC(uid) {
  253. let that = this;
  254. uni.showActionSheet({
  255. title: '',
  256. itemList: ['拒绝', '同意'],
  257. success: function(res) {
  258. if (res.tapIndex == 0) {
  259. that.actMem('noagree', uid);
  260. } else {
  261. that.actMem('agree', uid);
  262. }
  263. },
  264. fail: function(res) {
  265. console.log(res.errMsg);
  266. }
  267. });
  268. },
  269. actMenu(uid) {
  270. let that = this;
  271. uni.showActionSheet({
  272. title: '',
  273. itemList: ['禁言', '移除'],
  274. success: function(res) {
  275. if (res.tapIndex == 0) {
  276. that.actMem('lock', uid);
  277. } else {
  278. that.actMem('del', uid);
  279. }
  280. },
  281. fail: function(res) {
  282. console.log(res.errMsg);
  283. }
  284. });
  285. },
  286. actMem(act, uid) {
  287. let tips = '确定禁言吗?';
  288. if (act == 'del') {
  289. tips = '您确认删除吗?';
  290. }
  291. let that = this;
  292. this.$refs['DialogBox'].confirm({
  293. title: '提示',
  294. content: tips,
  295. DialogType: 'inquiry',
  296. btn1: '否',
  297. btn2: '是',
  298. animation: 0
  299. }).then((res) => {
  300. uni.showLoading({})
  301. uni.request({
  302. url: that.$apiHost2 + '/Chat/groupActMem', //仅为示例,并非真实接口地址。
  303. data: {
  304. uuid: getApp().globalData.uuid,
  305. groupId: that.groupId,
  306. userId: uid,
  307. act: act
  308. },
  309. header: {
  310. 'content-type': 'application/json' //自定义请求头信息
  311. },
  312. success: (res) => {
  313. console.log("----", res.data);
  314. that.$refs['ToastW3'].showToast({
  315. title: res.data.str,
  316. animation: 0
  317. });
  318. if (res.data.success == "yes") {
  319. this.loadData();
  320. }
  321. },
  322. complete: (com) => {
  323. uni.hideLoading();
  324. },
  325. });
  326. })
  327. },
  328. }
  329. }
  330. </script>
  331. <style scoped lang="scss">
  332. @import 'groupSetting.scss';
  333. </style>