remarks.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view>
  3. <view class="uni-title uni-common-pl">设置朋友的备注</view>
  4. <view class="uni-textarea">
  5. <textarea auto-height v-model="content" :maxlength="20"/>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import _get from '../../common/_get';
  11. import _hook from '../../common/_hook';
  12. export default {
  13. components:{
  14. },
  15. data() {
  16. return {
  17. user_id: '',
  18. is_type: 0,
  19. content: '',
  20. }
  21. },
  22. onShow(){
  23. _hook.routeSonHook();
  24. },
  25. onLoad(option){
  26. let _this = this;
  27. _this.user_id = option.user_id;
  28. _this.$httpSend({
  29. path: '/im/friend/getRemarks',
  30. data: { user_id: _this.user_id, },
  31. success(data) {
  32. _this.content = data.remarks;
  33. }
  34. });
  35. },
  36. computed:{
  37. },
  38. methods:{
  39. send(){
  40. let _this = this;
  41. if(_this.content == ''){
  42. uni.showToast({
  43. title: '备注不能为空',
  44. icon: 'none',
  45. });
  46. return;
  47. }
  48. _this.$httpSend({
  49. path: '/im/friend/setRemarks',
  50. data: { content: _this.content,user_id: _this.user_id, },
  51. success_action: true,
  52. success(res) {
  53. uni.showToast({
  54. title: res.msg,
  55. duration: 2000
  56. });
  57. _get.getFriendList();
  58. _get.getChatList();
  59. setTimeout(() => {
  60. uni.reLaunch({
  61. url: './index'
  62. });
  63. },2000);
  64. }
  65. });
  66. }
  67. },
  68. onNavigationBarButtonTap(e) {
  69. if(e.index == 0){
  70. this.send();
  71. }
  72. },
  73. watch:{
  74. },
  75. }
  76. </script>
  77. <style>
  78. </style>