message_more.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="page">
  3. <view class="uni-textarea">
  4. <textarea auto-height v-model="content" :maxlength="-1" placeholder="填写内容,1-600字" />
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import _get from '../../common/_get';
  10. import _hook from '../../common/_hook';
  11. import _data from '../../common/_data';
  12. export default {
  13. components:{
  14. },
  15. data() {
  16. return {
  17. content: '',
  18. type: '',
  19. list_id: 0,
  20. show_type: {
  21. name: {
  22. title: '群名称',
  23. },
  24. notice: {
  25. title: '群公告',
  26. }
  27. }
  28. }
  29. },
  30. onShow(){
  31. _hook.routeSonHook();
  32. },
  33. onLoad(option){
  34. let _this = this;
  35. _this.type = option.type;
  36. _this.list_id = option.list_id;
  37. uni.setNavigationBarTitle({
  38. title: (_this.show_type[_this.type].title + '设置'),
  39. });
  40. _this.$httpSend({
  41. path: '/im/message/getGroupData',
  42. data: { list_id: this.list_id,type: _this.type, },
  43. success(data) {
  44. _this.content = data;
  45. }
  46. });
  47. },
  48. computed: {
  49. },
  50. methods:{
  51. send(){
  52. let _this = this;
  53. _this.$httpSend({
  54. path: '/im/message/setGroupData',
  55. data: { content: _this.content,type: _this.type,list_id: _this.list_id, },
  56. success(data) {
  57. /** 如果是修改群名称,重新获得会话列表,和当前会话数据 */
  58. if(_this.type == 'name'){
  59. let chat_data = _data.localData(_this.list_id);
  60. chat_data.show_name = data.show_name;
  61. _data.localData(_this.list_id,chat_data);
  62. let chat_list = _data.localData('chat_list');
  63. for(let i = 0,j = chat_list.length;i < j;i ++){
  64. if(chat_list[i].list_id == _this.list_id){
  65. chat_list[i].show_name = _this.content;
  66. _data.localData('chat_list',chat_list);
  67. uni.$emit('data_chat_list',chat_list);
  68. break;
  69. }
  70. }
  71. }
  72. uni.showToast({
  73. title: '保存成功',
  74. duration: 2000
  75. });
  76. setTimeout(() => {
  77. uni.navigateBack();
  78. },2000);
  79. }
  80. });
  81. },
  82. radioChange(e){
  83. this.info[this.show_type[this.type].key] = e.target.value;
  84. },
  85. },
  86. onNavigationBarButtonTap(e) {
  87. this.send();
  88. },
  89. watch: {
  90. },
  91. }
  92. </script>
  93. <style>
  94. .page{
  95. margin-top: 15px;
  96. height: 300px;
  97. background-color: white;
  98. }
  99. page{
  100. }
  101. </style>