newGroup.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <image class="new_join" mode="widthFix" src="../../static/sms/new_join.png"></image>
  5. <view class="name" v-if="type == 'newGroup'">创建群聊</view>
  6. <view class="name" v-if="type == 'joinGroup'">加入群聊</view>
  7. <image class="qun_img" mode="widthFix" src="../../static/sms/qun_img.png"></image>
  8. <input class="qun_name" v-model="name" placeholder="请输入群聊名称" />
  9. <view class="btn_submit" @click="submitData" v-if="type == 'newGroup'">立即创建</view>
  10. <view class="btn_submit" @click="submitData" v-if="type == 'joinGroup'">申请加入</view>
  11. <view class="blankHeight"></view>
  12. </view>
  13. <!-- 提示框 -->
  14. <DialogBox ref="DialogBox"></DialogBox>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. type: 'newGroup',
  23. name: '',
  24. }
  25. },
  26. onLoad(parms) {
  27. this.type = parms.type || "newGroup"
  28. },
  29. onShow() {},
  30. methods: {
  31. onBack() {},
  32. submitData() {
  33. if (this.mobile == "") {
  34. uni.showToast({
  35. title: "请输入群聊名称",
  36. icon: 'none'
  37. });
  38. return;
  39. }
  40. let that = this;
  41. if (this.type == 'newGroup') {
  42. this.$refs['DialogBox'].confirm({
  43. title: '提示',
  44. content: '是否确定消耗100M币创建群聊',
  45. DialogType: 'inquiry',
  46. btn1: '否',
  47. btn2: '是',
  48. animation: 0
  49. }).then((res) => {
  50. that.submitData2();
  51. })
  52. } else {
  53. that.submitData2();
  54. }
  55. },
  56. submitData2() {
  57. uni.request({
  58. url: this.$apiHost2 + '/Chat/groupAction', //仅为示例,并非真实接口地址。
  59. data: {
  60. uuid: getApp().globalData.uuid,
  61. act: this.type,
  62. name: this.name
  63. },
  64. header: {
  65. 'content-type': 'application/json'
  66. },
  67. success: (res) => {
  68. console.log("res", res.data)
  69. uni.showToast({
  70. title: res.data.str,
  71. icon: 'none'
  72. });
  73. if (res.data.success == "yes") {
  74. setTimeout(function() {
  75. uni.navigateBack();
  76. }, 2000);
  77. }
  78. }
  79. });
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. @import 'newGroup.scss';
  86. </style>