backlist.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="page">
  3. <block v-if="list.length>0">
  4. <view class="friends" v-for="(item,index) in list" :key='index' @tap="open_detail(item)">
  5. <view class="avatar">
  6. <image :src="image_cache(item.avatar)"></image>
  7. </view>
  8. <view class="showname">
  9. {{item.nickname}}
  10. </view>
  11. </view>
  12. </block>
  13. <block v-else>
  14. <view style="height: 50px;line-height: 50px;text-align: center;color: #666;">
  15. 您还没有拉黑任何人
  16. </view>
  17. </block>
  18. </view>
  19. </template>
  20. <script>
  21. import http from "../../library/http.js"
  22. export default {
  23. data() {
  24. return {
  25. list: uni.getStorageSync('backlist')
  26. }
  27. },
  28. methods: {
  29. getbacklist(){
  30. http.setWait(false).get('user.php?act=getbacklist',{userid:uni.getStorageSync('access_token')}).then(res=>{
  31. console.log(res);
  32. this.list=res.data;
  33. uni.setStorageSync('backlist',res.data);
  34. })
  35. },
  36. open_detail(item){
  37. this.$jump('friend.detail',{id:item.id});
  38. },
  39. },
  40. onShow() {
  41. this.getbacklist();
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. .page{
  47. font-size:14px ;
  48. }
  49. .friends{
  50. padding: 5px 0px;
  51. height: 35px;
  52. line-height: 35px;
  53. display: table;
  54. table-layout: fixed;
  55. width: calc(100% - 0px);
  56. margin-bottom: 1px;
  57. }
  58. .friends .avatar{
  59. display: table-cell;
  60. width: 60px;
  61. text-align: center;
  62. }
  63. .friends .avatar image{
  64. height: 35px;
  65. width: 35px;
  66. border-radius: 5px;;
  67. vertical-align: middle;
  68. }
  69. .friends .showname {
  70. text-align:left;
  71. display: table-cell;
  72. font-size: 16px;
  73. color: #333;
  74. line-height: 35px;;
  75. vertical-align: middle;
  76. margin: 0px 0px;
  77. padding: 0px 0px;
  78. border-bottom: 1upx #EFEFEF solid;
  79. }
  80. </style>