updateGroupInfo.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view>
  3. <u-navbar :is-back="true" :title="titles[type]" :background="{ background: '#F6F7F8' }" title-color="#404133" :border-bottom="false" z-index="1001">
  4. <view class="slot-wrap" slot="right">
  5. <u-button :disabled="isInput" size="mini" type="success" @click="save">保存</u-button>
  6. </view>
  7. </u-navbar>
  8. <u-cell-group>
  9. <u-input v-if="type=='0'" v-model="context" :auto-height="true" />
  10. <u-input v-if="type=='1'" v-model="context" :auto-height="true" />
  11. <u-input v-if="type=='2'" v-model="context" :auto-height="true" />
  12. <u-input v-if="type=='3'" v-model="context" :auto-height="true" />
  13. </u-cell-group>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. type:'0',
  21. context:'',
  22. groupId:'',
  23. value: '',
  24. isInput:true,
  25. show: false,
  26. border: false,
  27. titles: ['设置名字','群名称','群公告','群昵称']
  28. }
  29. },
  30. watch:{
  31. context:function(v){
  32. this.isInput = v==undefined ? true : false;
  33. }
  34. },
  35. onLoad({groupId, context, type}) {
  36. this.groupId = groupId
  37. this.context = context
  38. this.type = type
  39. },
  40. onShow() {
  41. },
  42. methods: {
  43. save(){
  44. switch(this.type){
  45. case '0':
  46. this.updateNickName();
  47. break;
  48. case '1':
  49. this.updateGroupName();
  50. break;
  51. case '2':
  52. this.updateNotice();
  53. break;
  54. case '3':
  55. this.updateGroupNick();
  56. break;
  57. default:
  58. }
  59. },
  60. updateNickName () {
  61. this.$socket.updateNickName(this.userData.user.operId, this.context, (res) => {
  62. if (res.success) {
  63. uni.showToast({
  64. title: '成功',
  65. duration: 2000,
  66. });
  67. }
  68. })
  69. },
  70. updateGroupName(){
  71. this.$socket.updateGroupName(this.userData.user.operId, this.groupId, this.context, res => {
  72. if(res.success){
  73. uni.showToast({
  74. title: '成功',
  75. duration: 2000,
  76. });
  77. }else{
  78. uni.showToast({
  79. title: '失败',
  80. duration: 2000,
  81. });
  82. }
  83. })
  84. },
  85. updateNotice(){
  86. this.$socket.updateNotice(this.userData.user.operId, this.groupId, this.context, res => {
  87. if(res.success){
  88. uni.showToast({
  89. title: '成功',
  90. duration: 2000,
  91. });
  92. }else{
  93. uni.showToast({
  94. title: '失败',
  95. duration: 2000,
  96. });
  97. }
  98. })
  99. },
  100. updateGroupNick(){
  101. this.$socket.updateGroupNick(this.userData.user.operId, this.groupId, this.context, res => {
  102. if(res.success){
  103. uni.showToast({
  104. title: '成功',
  105. duration: 2000,
  106. });
  107. }else{
  108. uni.showToast({
  109. title: '失败',
  110. duration: 2000,
  111. });
  112. }
  113. })
  114. }
  115. }
  116. };
  117. </script>
  118. <style></style>