瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

455 lines
10 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="群组管理" bgColor="#5baaff" color="#fff" leftClick @leftClick="$utils.navigateBack" />
  4. <!-- 群组信息 -->
  5. <view class="group-info">
  6. <image :src="groupInfo.avatar || '/static/image/logo.jpg'" class="group-avatar" mode="aspectFill"></image>
  7. <view class="group-details">
  8. <view class="group-name">{{ groupInfo.name || '群组名称' }}</view>
  9. <view class="member-count">{{ groupInfo.memberCount || 0 }}</view>
  10. </view>
  11. </view>
  12. <!-- 管理选项 -->
  13. <view class="manage-options">
  14. <view class="option-item" @click="editGroupInfo">
  15. <view class="option-left">
  16. <uv-icon name="edit-pen" size="40rpx" color="#5baaff"></uv-icon>
  17. <text>编辑群组信息</text>
  18. </view>
  19. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  20. </view>
  21. <view class="option-item" @click="uploadQrCode">
  22. <view class="option-left">
  23. <uv-icon name="scan" size="40rpx" color="#5baaff"></uv-icon>
  24. <text>上传群聊二维码</text>
  25. </view>
  26. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  27. </view>
  28. <view class="option-item" @click="manageMembers">
  29. <view class="option-left">
  30. <uv-icon name="account" size="40rpx" color="#5baaff"></uv-icon>
  31. <text>成员管理</text>
  32. </view>
  33. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  34. </view>
  35. <view class="option-item" @click="editAnnouncement">
  36. <view class="option-left">
  37. <uv-icon name="volume" size="40rpx" color="#5baaff"></uv-icon>
  38. <text>群组公告</text>
  39. </view>
  40. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  41. </view>
  42. <view class="option-item" @click="groupSettings">
  43. <view class="option-left">
  44. <uv-icon name="setting" size="40rpx" color="#5baaff"></uv-icon>
  45. <text>群组设置</text>
  46. </view>
  47. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  48. </view>
  49. </view>
  50. <!-- 危险操作 -->
  51. <view class="danger-zone">
  52. <view class="danger-title">危险操作</view>
  53. <view class="danger-item" @click="transferGroup">
  54. <view class="danger-left">
  55. <uv-icon name="account" size="40rpx" color="#ff4757"></uv-icon>
  56. <text>转让群主</text>
  57. </view>
  58. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  59. </view>
  60. <view class="danger-item" @click="dissolveGroup">
  61. <view class="danger-left">
  62. <uv-icon name="close" size="40rpx" color="#ff4757"></uv-icon>
  63. <text>解散群组</text>
  64. </view>
  65. <uv-icon name="arrow-right" size="30rpx" color="#ccc"></uv-icon>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. groupId: '',
  75. groupInfo: {
  76. id: 1,
  77. name: '江华同城交流群',
  78. avatar: '/static/image/logo.jpg',
  79. memberCount: 1280
  80. }
  81. }
  82. },
  83. onLoad(options) {
  84. if (options.id) {
  85. this.groupId = options.id
  86. this.getGroupInfo()
  87. }
  88. },
  89. methods: {
  90. // 获取群组信息
  91. getGroupInfo() {
  92. // 模拟群组信息
  93. const mockGroupInfo = {
  94. 1: {
  95. id: 1,
  96. name: '江华同城交流群',
  97. avatar: '/static/image/logo.jpg',
  98. memberCount: 1280
  99. },
  100. 2: {
  101. id: 2,
  102. name: '江华美食分享群',
  103. avatar: '/static/image/logo.jpg',
  104. memberCount: 856
  105. },
  106. 3: {
  107. id: 3,
  108. name: '江华租房信息群',
  109. avatar: '/static/image/logo.jpg',
  110. memberCount: 2341
  111. },
  112. 4: {
  113. id: 4,
  114. name: '江华求职招聘群',
  115. avatar: '/static/image/logo.jpg',
  116. memberCount: 1567
  117. },
  118. 5: {
  119. id: 5,
  120. name: '江华旅游攻略群',
  121. avatar: '/static/image/logo.jpg',
  122. memberCount: 623
  123. },
  124. 6: {
  125. id: 6,
  126. name: '江华学习交流群',
  127. avatar: '/static/image/logo.jpg',
  128. memberCount: 445
  129. },
  130. 7: {
  131. id: 7,
  132. name: '江华二手交易群',
  133. avatar: '/static/image/logo.jpg',
  134. memberCount: 1890
  135. },
  136. 8: {
  137. id: 8,
  138. name: '江华宠物交流群',
  139. avatar: '/static/image/logo.jpg',
  140. memberCount: 567
  141. },
  142. 9: {
  143. id: 9,
  144. name: '江华汽车交流群',
  145. avatar: '/static/image/logo.jpg',
  146. memberCount: 892
  147. },
  148. 10: {
  149. id: 10,
  150. name: '江华宝妈交流群',
  151. avatar: '/static/image/logo.jpg',
  152. memberCount: 1234
  153. },
  154. 11: {
  155. id: 11,
  156. name: '江华IT技术交流群',
  157. avatar: '/static/image/logo.jpg',
  158. memberCount: 345
  159. },
  160. 12: {
  161. id: 12,
  162. name: '江华健身运动群',
  163. avatar: '/static/image/logo.jpg',
  164. memberCount: 678
  165. },
  166. 13: {
  167. id: 13,
  168. name: '江华摄影爱好者群',
  169. avatar: '/static/image/logo.jpg',
  170. memberCount: 456
  171. },
  172. 14: {
  173. id: 14,
  174. name: '江华创业交流群',
  175. avatar: '/static/image/logo.jpg',
  176. memberCount: 789
  177. },
  178. 15: {
  179. id: 15,
  180. name: '江华医疗健康群',
  181. avatar: '/static/image/logo.jpg',
  182. memberCount: 1123
  183. },
  184. 16: {
  185. id: 16,
  186. name: '江华读书会',
  187. avatar: '/static/image/logo.jpg',
  188. memberCount: 234
  189. },
  190. 17: {
  191. id: 17,
  192. name: '江华音乐爱好者群',
  193. avatar: '/static/image/logo.jpg',
  194. memberCount: 567
  195. },
  196. 18: {
  197. id: 18,
  198. name: '江华电商交流群',
  199. avatar: '/static/image/logo.jpg',
  200. memberCount: 890
  201. },
  202. 19: {
  203. id: 19,
  204. name: '江华园艺爱好者群',
  205. avatar: '/static/image/logo.jpg',
  206. memberCount: 345
  207. },
  208. 20: {
  209. id: 20,
  210. name: '江华法律咨询群',
  211. avatar: '/static/image/logo.jpg',
  212. memberCount: 678
  213. }
  214. }
  215. setTimeout(() => {
  216. this.groupInfo = mockGroupInfo[this.groupId] || this.groupInfo
  217. }, 300)
  218. },
  219. // 编辑群组信息
  220. editGroupInfo() {
  221. this.$utils.navigateTo('/pages_order/group/editGroup?id=' + this.groupId)
  222. },
  223. // 上传群聊二维码
  224. uploadQrCode() {
  225. uni.chooseImage({
  226. count: 1,
  227. sizeType: ['original', 'compressed'],
  228. sourceType: ['album', 'camera'],
  229. success: (res) => {
  230. const tempFilePath = res.tempFilePaths[0]
  231. // 显示预览
  232. uni.previewImage({
  233. urls: [tempFilePath],
  234. success: () => {
  235. // 确认上传
  236. uni.showModal({
  237. title: '确认上传',
  238. content: '确定要上传这张二维码图片吗?',
  239. success: (modalRes) => {
  240. if (modalRes.confirm) {
  241. this.uploadQrCodeImage(tempFilePath)
  242. }
  243. }
  244. })
  245. }
  246. })
  247. },
  248. fail: (err) => {
  249. uni.showToast({
  250. title: '选择图片失败',
  251. icon: 'none'
  252. })
  253. }
  254. })
  255. },
  256. // 上传二维码图片
  257. uploadQrCodeImage(filePath) {
  258. uni.showLoading({
  259. title: '上传中...'
  260. })
  261. // 模拟上传过程
  262. setTimeout(() => {
  263. uni.hideLoading()
  264. uni.showToast({
  265. title: '上传成功',
  266. icon: 'success'
  267. })
  268. // 这里可以调用实际的上传API
  269. // uni.uploadFile({
  270. // url: 'your-upload-api',
  271. // filePath: filePath,
  272. // name: 'qrcode',
  273. // formData: {
  274. // groupId: this.groupId
  275. // },
  276. // success: (uploadRes) => {
  277. // // 处理上传成功
  278. // }
  279. // })
  280. }, 2000)
  281. },
  282. // 成员管理
  283. manageMembers() {
  284. this.$utils.navigateTo('/pages_order/group/memberManage?id=' + this.groupId)
  285. },
  286. // 编辑公告
  287. editAnnouncement() {
  288. uni.showModal({
  289. title: '编辑群组公告',
  290. content: '请输入新的群组公告',
  291. editable: true,
  292. placeholderText: '请输入公告内容',
  293. success: (res) => {
  294. if (res.confirm && res.content) {
  295. this.updateAnnouncement(res.content)
  296. }
  297. }
  298. })
  299. },
  300. // 更新公告
  301. updateAnnouncement(content) {
  302. // 模拟更新公告
  303. setTimeout(() => {
  304. uni.showToast({
  305. title: '公告更新成功',
  306. icon: 'success'
  307. })
  308. }, 500)
  309. },
  310. // 群组设置
  311. groupSettings() {
  312. this.$utils.navigateTo('/pages_order/group/groupSettings?id=' + this.groupId)
  313. },
  314. // 转让群主
  315. transferGroup() {
  316. uni.showModal({
  317. title: '转让群主',
  318. content: '确定要转让群主身份吗?转让后将失去群主权限。',
  319. success: (res) => {
  320. if (res.confirm) {
  321. // 跳转到选择新群主页面
  322. this.$utils.navigateTo('/pages_order/group/transferGroup?id=' + this.groupId)
  323. }
  324. }
  325. })
  326. },
  327. // 解散群组
  328. dissolveGroup() {
  329. uni.showModal({
  330. title: '解散群组',
  331. content: '确定要解散该群组吗?解散后所有成员将被移出群组,且无法恢复。',
  332. success: (res) => {
  333. if (res.confirm) {
  334. // 模拟解散群组
  335. setTimeout(() => {
  336. uni.showToast({
  337. title: '群组已解散',
  338. icon: 'success'
  339. })
  340. setTimeout(() => {
  341. this.$utils.navigateBack()
  342. }, 1500)
  343. }, 500)
  344. }
  345. }
  346. })
  347. }
  348. }
  349. }
  350. </script>
  351. <style scoped lang="scss">
  352. .page {
  353. background-color: #f5f5f5;
  354. min-height: 100vh;
  355. .group-info {
  356. background-color: #fff;
  357. padding: 30rpx;
  358. margin-bottom: 20rpx;
  359. display: flex;
  360. align-items: center;
  361. .group-avatar {
  362. width: 100rpx;
  363. height: 100rpx;
  364. border-radius: 20rpx;
  365. margin-right: 20rpx;
  366. }
  367. .group-details {
  368. flex: 1;
  369. .group-name {
  370. font-size: 32rpx;
  371. font-weight: bold;
  372. color: #333;
  373. margin-bottom: 8rpx;
  374. }
  375. .member-count {
  376. font-size: 24rpx;
  377. color: #999;
  378. }
  379. }
  380. }
  381. .manage-options, .danger-zone {
  382. background-color: #fff;
  383. margin-bottom: 20rpx;
  384. .option-item, .danger-item {
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. padding: 30rpx;
  389. border-bottom: 1rpx solid #f0f0f0;
  390. &:last-child {
  391. border-bottom: none;
  392. }
  393. .option-left, .danger-left {
  394. display: flex;
  395. align-items: center;
  396. text {
  397. margin-left: 20rpx;
  398. font-size: 28rpx;
  399. color: #333;
  400. }
  401. }
  402. }
  403. }
  404. .danger-zone {
  405. .danger-title {
  406. padding: 20rpx 30rpx;
  407. font-size: 28rpx;
  408. color: #ff4757;
  409. font-weight: bold;
  410. border-bottom: 1rpx solid #f0f0f0;
  411. }
  412. .danger-item {
  413. .danger-left {
  414. text {
  415. color: #ff4757;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. </style>