logout_words.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="body" :style="'height:'+windowHeight">
  3. <view class="warp">
  4. <view class="title">
  5. 移除[{{item.nickname}}]的理由
  6. </view>
  7. <view class="words">
  8. <view v-for="(m,index) in words" :key='index' :class="checked.indexOf(m)>-1?'word active':'word'" @tap="check_word(m)">
  9. {{m}}
  10. </view>
  11. </view>
  12. <view style="margin-top:10px;text-align: center;">
  13. <button class="layer_btns cancel" @tap="cancel">
  14. <uni-icons type='close' style="font-size: 18px;margin-right: 5px;color: #333;font-weight: 600;"></uni-icons>
  15. 取消</button>
  16. <button class="layer_btns ok" @tap="sub()">
  17. <uni-icons type='checkbox' style="font-size: 18px;color: #fff;margin-right: 5px;"></uni-icons>
  18. 确认</button>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. var windowHeight= uni.getSystemInfoSync().screenHeight;
  25. import uniIcons from './uni-icons/uni-icons.vue'
  26. export default {
  27. components:{
  28. uniIcons
  29. },
  30. props: {
  31. item: {
  32. required: true
  33. }
  34. },
  35. data() {
  36. return {
  37. windowHeight:windowHeight+'px',
  38. system:uni.getStorageSync('system'),
  39. words:'',
  40. checked:'',
  41. user:uni.getStorageSync('userInfo')
  42. };
  43. },
  44. methods:{
  45. cancel(){
  46. this.$emit('cancle')
  47. },
  48. sub(){
  49. var tips="是否要将["+this.item.nickname+"]移除本群?";
  50. var that=this;
  51. uni.showModal({
  52. title: '提示',
  53. content: tips,
  54. success: function (res) {
  55. if (res.confirm) {
  56. var data={type:'deleteGroup',group_id:that.item.group_id,userid:that.item.userid,fromid:that.user.id,mark:that.checked};
  57. that.$socket.send(data);
  58. setTimeout(function(){
  59. that.$emit('sub')
  60. that.$emit('cancle')
  61. },100)
  62. }
  63. }
  64. });
  65. },
  66. check_word(word){
  67. var checked=this.checked.split(',');
  68. if(this.checked.indexOf(word)>-1){
  69. var arr=[];
  70. for(var i=0;i<checked.length;i++){
  71. if(checked[i]!=word){
  72. arr.push(checked[i]);
  73. }
  74. }
  75. this.checked=arr.join(',');
  76. }else{
  77. if(checked.length>=this.system['logout_wordsnum']){
  78. uni.showToast({
  79. icon:'none',
  80. title:'最多可以选择'+this.system['logout_wordsnum']+'个踢出理由'
  81. })
  82. return false;
  83. }
  84. if(this.checked!='') this.checked+=','
  85. this.checked+=word;
  86. }
  87. }
  88. },
  89. mounted(){
  90. this.words=this.system['logout_words'].split('|');
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. .body{
  96. position: fixed;
  97. left: 0px;
  98. width: 100%;
  99. top:0px;
  100. z-index: 10;
  101. background-color: rgba($color: #000000, $alpha:0.6);
  102. }
  103. .warp {
  104. position: fixed;
  105. left: 10%;
  106. width: 80%;
  107. top:25%;
  108. max-height: 400px;
  109. z-index: 10;
  110. background-color: #fff;
  111. border-radius: 10px;
  112. padding: 5px 0px;
  113. border: 1px #eee solid;
  114. }
  115. .warp .title{
  116. height:40px;
  117. line-height: 40px;
  118. text-align: center;
  119. color: #000;
  120. font-size: 16px;
  121. }
  122. .words{
  123. max-height: 300px;
  124. overflow-y: scroll;
  125. width: 100%;
  126. text-align: center;
  127. }
  128. .words .word{
  129. display: inline-block;
  130. margin: 5px 8px;
  131. height: 32px; line-height: 32px;
  132. padding: 0px 5px;
  133. min-width: 70px;
  134. border: 1px #666 solid;
  135. border-radius: 5px;
  136. color: #666;
  137. background-color: #fff;
  138. }
  139. .words .word.active{
  140. border: 1px #2319dc solid;
  141. color: #fff;
  142. background-color: #2319dc;
  143. }
  144. .layer_btns{
  145. display: inline-block;
  146. line-height:35px;
  147. padding: 0px 20px;
  148. border-radius: 5px;
  149. border: 0px;
  150. text-align: center;
  151. cursor: pointer;
  152. height:35px;
  153. color:#fff;
  154. margin:0px 10px;
  155. font-size:16px;
  156. }
  157. .layer_btns.ok{
  158. background: -webkit-linear-gradient(left top, #3388ff , #2319dc);
  159. background: -o-linear-gradient(bottom right, #3388ff, #2319dc);
  160. background: -moz-linear-gradient(bottom right, #3388ff, #2319dc);
  161. background: linear-gradient(to bottom right, #3388ff , #2319dc);
  162. }
  163. .layer_btns.cancel{
  164. border: 1px solid #666;
  165. color: #666;
  166. background-color: #fff;
  167. }
  168. </style>