more_details.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="page">
  3. <navigator hover-class="none" :url="'/pages/friend/remarks?user_id=' + user_id" animation-type="slide-in-bottom">
  4. <view class="uni-list">
  5. <view class="uni-list-cell" hover-class="none">
  6. <view class="uni-list-cell-navigate uni-navigate-right">
  7. <view style="width:100%">
  8. 设置备注和标签
  9. </view>
  10. </view>
  11. </view>
  12. </view>
  13. </navigator>
  14. <view class="switch_class" style="margin-top: 20upx;" v-if="0">
  15. <view class="uni-list">
  16. <view class="uni-list-cell uni-list-cell-pd">
  17. <view class="uni-list-cell-db">置顶聊天</view>
  18. <switch color="#02b300" :checked="false" />
  19. </view>
  20. <view class="uni-list-cell uni-list-cell-pd" v-if="0">
  21. <view class="uni-list-cell-db">消息免打扰</view>
  22. <switch color="#02b300" />
  23. </view>
  24. <view class="uni-list-cell uni-list-cell-pd" v-if="0">
  25. <view class="uni-list-cell-db">强提醒</view>
  26. <switch color="#02b300"/>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="uni-list" style="margin-top: 20upx;" v-if="data.remove">
  31. <view class="uni-list-cell" hover-class="none">
  32. <view class="uni-list-cell-navigate" @tap="goDelete">
  33. <view class="tool">
  34. 删除
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import _hook from '../../common/_hook';
  43. import _get from '../../common/_get';
  44. import _data from '../../common/_data';
  45. export default {
  46. data() {
  47. return {
  48. user_id: 0,
  49. data: {
  50. remove: 0,
  51. },
  52. };
  53. },
  54. computed: {
  55. },
  56. onShow(){
  57. _hook.routeSonHook();
  58. },
  59. methods: {
  60. goDelete(){
  61. let _this = this;
  62. uni.showModal({
  63. title: '重要提示',
  64. content: '删除好友及相关的会话数据并且不能恢复,确认删除吗?',
  65. success: function (res) {
  66. if (res.confirm) {
  67. _this.$httpSend({
  68. path: '/im/remove/friend',
  69. data: { user_id: _this.user_id },
  70. success(list_id) {
  71. uni.showToast({
  72. title: '操作成功',
  73. duration: 1500
  74. });
  75. /** 删除会话列表数据 **/
  76. for(let i = 0,local_chat_list = _data.localData('chat_list'),j = local_chat_list.length;i < j;i ++){
  77. if(local_chat_list[i].list_id == list_id){
  78. local_chat_list.splice(i,1);
  79. _data.localData('chat_list',local_chat_list);
  80. uni.$emit('data_chat_list',local_chat_list);
  81. break;
  82. }
  83. }
  84. /** 删除对话数据 */
  85. _data.localData(list_id,null);
  86. /** 从我的好友列表里删除 */
  87. for(let i = 0,v = _data.localData('friend_list'),j = v.length;i < j;i ++){
  88. for(let k = 0,o = v[i].data,l = o.length;k < l;k ++){
  89. if(o[k].user_id == _this.user_id){
  90. v[i].data.splice(k,1);
  91. _data.localData('friend_list',v);
  92. uni.$emit('data_friend_list',v);
  93. break;
  94. }
  95. }
  96. }
  97. setTimeout(() => {
  98. uni.switchTab({
  99. url: '../friend/index',
  100. });
  101. },1600);
  102. }
  103. });
  104. }
  105. }
  106. });
  107. }
  108. },
  109. onLoad(option) {
  110. this.user_id = option.user_id;
  111. let _this = this;
  112. _this.$httpSend({
  113. path: '/im/friend/details',
  114. data: { user_id: _this.user_id },
  115. success(data) {
  116. _this.data = data;
  117. }
  118. });
  119. },
  120. }
  121. </script>
  122. <style>
  123. .tool {
  124. width:100%;
  125. text-align: center;
  126. color: red;
  127. }
  128. </style>