select.vue 3.6 KB

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