group_trans.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view class="page">
  3. <scroll-view class="scrollList" scroll-y :scroll-into-view="scrollViewId" :style="{height:winHeight + 'px'}">
  4. <view class="uni-list">
  5. <block v-for="(list, key) in list_data" :key="key">
  6. <view class="uni-list-cell-divider" :id="list.letter">
  7. {{list.letter}}
  8. </view>
  9. <view class="uni-list-cell"
  10. hover-class="none"
  11. v-for="(item,index) of list.data"
  12. :class="list.data.length -1 == index ? 'uni-list-cell-last' : ''"
  13. :key="isKey(key,index)"
  14. >
  15. <checkbox-group @change="change">
  16. <label class="uni-list-cell uni-list-cell-pd">
  17. <view>
  18. <checkbox color="#02b300"
  19. :checked="current == item.user_id"
  20. :value="item.user_id + ''"
  21. />
  22. </view>
  23. <view class="uni-media-list">
  24. <view class="uni-media-list-logo">
  25. <image :src="staticPhoto + item.photo" :lazy-load="true"/>
  26. </view>
  27. <view class="uni-media-list-body">
  28. <view class="uni-list-cell-navigate">{{item.name}}</view>
  29. </view>
  30. </view>
  31. </label>
  32. </checkbox-group>
  33. </view>
  34. </block>
  35. </view>
  36. </scroll-view>
  37. <view class="uni-indexed-list-bar" :class="touchmove ? 'active' : ''" @touchstart="touchStart" @touchmove="touchMove"
  38. @touchend="touchEnd" @touchcancel="touchCancel" :style="{height:winHeight + 'px'}">
  39. <text v-for="(list,key) in list_data" :key="key" class="uni-indexed-list-text" :class="touchmoveIndex == key ? 'active' : ''"
  40. :style="{height:itemHeight + 'px',lineHeight:itemHeight + 'px'}">
  41. {{list.letter}}
  42. </text>
  43. </view>
  44. <view class="uni-indexed-list-alert" v-if="touchmove">
  45. {{list_data[touchmoveIndex].letter}}
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import uniIcon from '../../components/uni-ui/uni-icon/uni-icon.vue';
  51. import uniList from '../../components/uni-ui/uni-list/uni-list.vue';
  52. import uniListItem from '../../components/uni-ui/uni-list-item/uni-list-item.vue';
  53. import _get from '../../common/_get';
  54. import _hook from '../../common/_hook';
  55. import _data from '../../common/_data';
  56. export default {
  57. components: {
  58. uniIcon,
  59. uniList,
  60. uniListItem,
  61. },
  62. data() {
  63. return {
  64. list_data: [],
  65. title: 'grid',
  66. touchmove: false,
  67. touchmoveIndex: -1,
  68. itemHeight: 0,
  69. winHeight: 0,
  70. scrollViewId: "A",
  71. titleHeight: 0,
  72. list_id: 0,
  73. add_user_ids: [],
  74. type: 0,
  75. current:0
  76. }
  77. },
  78. onShow(){
  79. _hook.routeTabBarHook();
  80. },
  81. onLoad(option) {
  82. let _this = this;
  83. _this.list_id = option.list_id;
  84. _this.type = option.type;
  85. if(_this.type == 2){
  86. uni.setNavigationBarTitle({
  87. title: '禁言设置',
  88. });
  89. }
  90. _this.$httpSend({
  91. path: '/im/message/getGroupAdmin',
  92. data: { list_id: this.list_id,type: _this.type, },
  93. success(data) {
  94. _this.list_data = data.list;
  95. _this.add_user_ids = data.user_ids;
  96. }
  97. });
  98. let winHeight = uni.getSystemInfoSync().windowHeight;
  99. _this.itemHeight = winHeight / 26;
  100. _this.winHeight = winHeight;
  101. },
  102. computed: {
  103. staticPhoto(){
  104. return _data.staticPhoto();
  105. }
  106. },
  107. methods: {
  108. change(event){
  109. let indexObject = {};
  110. for (let i = 0; i < this.list_data.length; i++) {
  111. for (let j= 0 ;j <this.list_data[i].data.length;j++){
  112. console.log(this.list_data[i].data[j])
  113. if(this.list_data[i].data[j].user_id == event.target.value){
  114. this.current = event.target.value;
  115. break;
  116. }
  117. }
  118. // if (this.list_data[i].data[i].user_id === event.target.value) {
  119. // }
  120. }
  121. },
  122. isKey(key,index){
  123. return key + '' + index;
  124. },
  125. touchStart(e) {
  126. this.touchmove = true;
  127. let pageY = e.touches[0].pageY;
  128. let index = Math.floor((pageY - this.titleHeight) / this.itemHeight);
  129. let item = this.list_data[index];
  130. if (item) {
  131. this.scrollViewId = item.letter;
  132. this.touchmoveIndex = index;
  133. }
  134. },
  135. touchMove(e) {
  136. let pageY = e.touches[0].pageY;
  137. let index = Math.floor((pageY - this.titleHeight) / this.itemHeight);
  138. let item = this.list_data[index];
  139. if (item) {
  140. this.scrollViewId = item.letter;
  141. this.touchmoveIndex = index;
  142. }
  143. },
  144. touchEnd() {
  145. this.touchmove = false;
  146. //this.touchmoveIndex = -1;
  147. },
  148. touchCancel() {
  149. this.touchmove = false;
  150. //this.touchmoveIndex = -1;
  151. },
  152. },
  153. watch: {
  154. },
  155. onNavigationBarButtonTap(e) {
  156. let _this = this;
  157. let trans_user_id = _this.current[0];
  158. //转让群
  159. _this.$httpSend({
  160. path: '/im/vendor/transferQun',
  161. data: { trans_user_id: trans_user_id,list_id: _this.list_id },
  162. success_action: true,
  163. success(res) {
  164. uni.showToast({
  165. title: res.msg,
  166. duration: 2000
  167. });
  168. setTimeout(() => {
  169. uni.redirectTo({
  170. url: '../chat/message/more?list_id=' + _this.list_id,
  171. });
  172. },2000);
  173. }
  174. });
  175. }
  176. }
  177. </script>
  178. <style>
  179. .page {
  180. display: flex;
  181. flex-direction:row;
  182. }
  183. .scrollList {
  184. flex: 1;
  185. height: 100vh;
  186. }
  187. .uni-indexed-list-bar {
  188. width: 40upx;
  189. height: 100vh;
  190. background-color: #e7e7e7;
  191. display: flex;
  192. flex-direction: column;
  193. }
  194. .uni-indexed-list-bar.active {
  195. /* background-color: rgb(200, 200, 200); */
  196. }
  197. .uni-indexed-list-text {
  198. font-size: 22upx;
  199. text-align: center;
  200. }
  201. .uni-indexed-list-bar.active .uni-indexed-list-text {
  202. color: #333;
  203. }
  204. .uni-indexed-list-text.active,
  205. .uni-indexed-list-bar.active .uni-indexed-list-text.active {
  206. color: #02b300;
  207. }
  208. .uni-indexed-list-alert {
  209. position: absolute;
  210. z-index: 20;
  211. width: 160upx;
  212. height: 160upx;
  213. left: 50%;
  214. top: 50%;
  215. margin-left: -80upx;
  216. margin-top: -80upx;
  217. border-radius: 80upx;
  218. text-align: center;
  219. line-height: 160upx;
  220. font-size: 70upx;
  221. color: #fff;
  222. background-color: rgba(0, 0, 0, 0.5);
  223. }
  224. .header {
  225. display: flex;
  226. flex-direction: row;
  227. padding: 10px 15px;
  228. align-items: center;
  229. }
  230. .input-view {
  231. display: flex;
  232. align-items: center;
  233. flex-direction: row;
  234. background-color: #e7e7e7;
  235. height: 30px;
  236. border-radius: 5px;
  237. padding: 0 10px;
  238. flex: 1;
  239. }
  240. .input {
  241. flex: 1;
  242. padding: 0 5px;
  243. height: 24px;
  244. line-height: 24px;
  245. font-size: 16px;
  246. }
  247. .uni-list-cell-navigate {
  248. padding: 0;
  249. }
  250. .uni-media-list-body {
  251. height: auto;
  252. }
  253. </style>