ActionSheet.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <u-action-sheet
  3. safeAreaInsetBottom
  4. closeOnClickOverlay
  5. @close="onClose"
  6. @select="onSelect"
  7. round="24"
  8. :actions="joinGroupActions"
  9. :show="visible"
  10. cancelText="取消"
  11. />
  12. </template>
  13. <script>
  14. import IMSDK, { GroupVerificationType } from "openim-uniapp-polyfill";
  15. export default {
  16. name: "",
  17. components: {},
  18. props: {
  19. visible: Boolean,
  20. groupID: String,
  21. },
  22. data() {
  23. return {
  24. joinGroupActions: [
  25. {
  26. name: "允许任何人加群",
  27. type: GroupVerificationType.AllNot,
  28. },
  29. {
  30. name: "群成员邀请无需验证",
  31. type: GroupVerificationType.ApplyNeedInviteNot,
  32. },
  33. {
  34. name: "需要发送验证消息",
  35. type: GroupVerificationType.AllNeed,
  36. },
  37. ],
  38. };
  39. },
  40. methods: {
  41. onClose() {
  42. this.$emit("update:visible", false);
  43. },
  44. onSelect({ type }) {
  45. IMSDK.asyncApi(IMSDK.IMMethods.SetGroupVerification, IMSDK.uuid(), {
  46. groupID: this.groupID,
  47. verification: type,
  48. })
  49. .then(() => uni.$u.toast("操作成功"))
  50. .catch(() => uni.$u.toast("操作失败"));
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="scss"></style>