select.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view >
  3. <view class="friend-bg">
  4. <image style="width: 750rpx;height: 406rpx;" src="../../../static/friend/friend-bg.png"></image>
  5. <image style="position: absolute; left: 34rpx;top: 120rpx; width: 22rpx; height: 42rpx;"
  6. src="../../../static/friend/back.png" @click="onBack()"></image>
  7. </view>
  8. <view style="height: 100px;"></view>
  9. <scroll-view :style="{ height: scrollviewHight + 'px' }" scroll-y="true">
  10. <view class="cu-list menu-avatar margin-top">
  11. <view class="cu-item card-view" :class=" index == selectIndex?' friend-select':''" style="height: 180rpx;" v-for="(item, index) in friends" :key="index" @click="onSelectIndex(index,item)">
  12. <view class="cu-avatar round lg"
  13. :style="[{ backgroundImage:'url('+item.avatarUrl+')' }]">
  14. <view class="cu-tag badge-bottom" >
  15. <image v-if="item.gender == 0" style="height: 32rpx;width: 32rpx;" src="../../../static/friend/boy.png"></image>
  16. <image v-if="item.gender == 1" style="height: 32rpx;width: 32rpx;" src="../../../static/friend/girl.png"></image>
  17. </view>
  18. </view>
  19. <view class="content" style="width: 360rpx;">
  20. <view class="text-grey">{{item.username}}</view>
  21. <view class="text-gray text-sm flex">
  22. <view class="text-cut">
  23. <text class="cuIcon-infofill text-red margin-right-xs"></text>
  24. {{item.signature}}
  25. </view>
  26. </view>
  27. <!-- <view class="text-gray text-sm flex">
  28. <view class="text-cut">
  29. <text class="cuIcon-infofill text-red margin-right-xs"></text>
  30. 我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。
  31. </view>
  32. </view> -->
  33. </view>
  34. <view class="action" style="width: 160rpx; ">
  35. <image class=" make-lines-bPurple" style="width: 126rpx; height: 60rpx;"
  36. src="../../../static/friend/pk-button.png"></image>
  37. </view>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. <!-- <view class="padding flex flex-direction" style="z-index: 10; position: absolute;bottom: 34rpx; left: 0;right: 0;">
  42. <button class="cu-btn make-bg-bPurple text-white lg" style="border-radius: 20rpx;">健身模式</button>
  43. </view> -->
  44. </view>
  45. </template>
  46. <script>
  47. import config from '../../../common/config.js';
  48. import reqUtil from '../../../util/util-js/requstUtil.js';
  49. import {
  50. mapState,
  51. mapMutations
  52. } from 'vuex';
  53. export default {
  54. computed: mapState(['systemInfo']),
  55. data() {
  56. return {
  57. selectIndex:-1,
  58. scrollviewHight:0,
  59. friends:[]
  60. }
  61. },
  62. onReady() {
  63. console.log(this.systemInfo);
  64. // 计算组件的高度
  65. this.scrollviewHight = this.systemInfo.windowHeight - 100;
  66. },
  67. onShow() {
  68. reqUtil.requestData(config.URL.GETFRIENDLIST, {}).then(
  69. res => {
  70. // console.log(JSON.stringify(res));
  71. this.friends = res.data.friends;
  72. },
  73. e => {
  74. console.log(e);
  75. }
  76. );
  77. },
  78. methods: {
  79. ...mapMutations(['setFinallSelectFriendInfo'
  80. ]),
  81. onSelectIndex(index,item){
  82. this.selectIndex = index;
  83. // console.log(item);
  84. this.setFinallSelectFriendInfo(item);
  85. },
  86. onBack() {
  87. uni.navigateBack({
  88. delta: 1
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. .friend-bg {
  96. position: absolute;
  97. top: -60rpx;
  98. left: 0;
  99. right: 0;
  100. /* bottom: 0; */
  101. margin: auto;
  102. width: 750rpx;
  103. height: 406rpx;
  104. }
  105. .friend-select {
  106. /* box-sizing: content-box; */
  107. border: 4rpx solid #9797FF;
  108. }
  109. </style>