updateGroupInfo.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 v-if="type=='0'">
  15. <view class="solid-bottom text-sm padding">
  16. <text class="text-grey">首次使用粮信请按要求修改名称</text>
  17. </view>
  18. <view class="solid-bottom text-sm padding">
  19. <text class="text-grey">请填写规范名称</text>
  20. </view>
  21. <view class="solid-bottom text-sm padding">
  22. <text class="text-grey">企业用户:公司-职务-姓名</text>
  23. </view>
  24. <view class="solid-bottom text-sm padding">
  25. <text class="text-grey">例:易粮易运-销售-张三</text>
  26. </view>
  27. <view class="solid-bottom text-sm padding">
  28. <text class="text-grey">个人用户:地址-姓名</text>
  29. </view>
  30. <view class="solid-bottom text-sm padding">
  31. <text class="text-grey">例:某烘干塔-张三</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. type:'0',
  41. context:'',
  42. groupId:'',
  43. value: '',
  44. isInput:true,
  45. show: false,
  46. border: false,
  47. titles: ['设置名字','群名称','群公告','群昵称']
  48. }
  49. },
  50. watch:{
  51. context:function(v){
  52. this.isInput = v==undefined ? true : false;
  53. }
  54. },
  55. onLoad({groupId, context, type}) {
  56. this.groupId = groupId
  57. this.context = context
  58. this.type = type
  59. },
  60. onShow() {
  61. },
  62. methods: {
  63. save(){
  64. switch(this.type){
  65. case '0':
  66. this.updateNickName();
  67. break;
  68. case '1':
  69. this.updateGroupName();
  70. break;
  71. case '2':
  72. this.updateNotice();
  73. break;
  74. case '3':
  75. this.updateGroupNick();
  76. break;
  77. default:
  78. }
  79. },
  80. updateNickName () {
  81. console.log(this.userData)
  82. var that = this
  83. this.$socket.updateNickName(this.userData.user.operId, this.context, (res) => {
  84. if (res.success) {
  85. that.userData.user.realname = that.context
  86. that.$u.vuex("userData",that.userData)
  87. uni.showToast({
  88. title: '修改成功',
  89. duration: 1000,
  90. });
  91. setTimeout(()=>{uni.navigateBack({})},1000);
  92. }
  93. })
  94. },
  95. updateGroupName(){
  96. this.$socket.updateGroupName(this.userData.user.operId, this.groupId, this.context, res => {
  97. if(res.success){
  98. uni.showToast({
  99. title: '成功',
  100. duration: 2000,
  101. });
  102. }else{
  103. uni.showToast({
  104. title: '失败',
  105. duration: 2000,
  106. });
  107. }
  108. })
  109. },
  110. updateNotice(){
  111. this.$socket.updateNotice(this.userData.user.operId, this.groupId, this.context, res => {
  112. if(res.success){
  113. uni.showToast({
  114. title: '成功',
  115. duration: 2000,
  116. });
  117. }else{
  118. uni.showToast({
  119. title: '失败',
  120. duration: 2000,
  121. });
  122. }
  123. })
  124. },
  125. updateGroupNick(){
  126. this.$socket.updateGroupNick(this.userData.user.operId, this.groupId, this.context, res => {
  127. if(res.success){
  128. uni.showToast({
  129. title: '成功',
  130. duration: 2000,
  131. });
  132. }else{
  133. uni.showToast({
  134. title: '失败',
  135. duration: 2000,
  136. });
  137. }
  138. })
  139. }
  140. }
  141. };
  142. </script>
  143. <style></style>