face.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <u-search v-model="keyword" @change="search" placeholder="搜索" shape="square" :show-action="false" :bg-color="'#ffffff'"></u-search>
  4. <view style="height: 10rpx;"></view>
  5. <u-swiper :list="list"></u-swiper>
  6. <view class="title">精选</view>
  7. <view class="item bg_view" v-for="(item, index) in faces" hover-class="message-hover-class">
  8. <image mode="aspectFill" :src="item.faceUrl" />
  9. <view class="right u-border-bottom title-wrap">
  10. <view class="right_top">
  11. <view class="right_top_name u-line-1">{{item.faceName}}</view>
  12. </view>
  13. <view class="right_btm ">
  14. <view class="u-line-1">{{item.faceDesc}}</view>
  15. <view class="">
  16. <u-button :plain="true" type="success" size="mini" v-on:click="addFaceUser(item.id)">添加</u-button>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. keyword:'',
  28. list: [],
  29. faces:[]
  30. };
  31. },
  32. watch:{},
  33. methods:{
  34. addFaceUser(faceId){
  35. this.$socket.addFaceUser(this.userData.user.operId, faceId, res=>{
  36. if(res.success){
  37. uni.showToast({
  38. title:'添加成功',
  39. icon:'success'
  40. })
  41. }
  42. })
  43. },
  44. search(){
  45. this.$socket.listFaces(this.keyword,res=>{
  46. this.faces = res.response.data
  47. })
  48. }
  49. },
  50. onShow() {
  51. this.search()
  52. this.$socket.listBanner(res=>{
  53. this.list = res.response.data
  54. })
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .title{
  60. height: 80rpx;
  61. background-color: #fff;
  62. font-size: 30rpx;
  63. padding: 10rpx;
  64. }
  65. .item {
  66. width: 750rpx;
  67. display: flex;
  68. align-items: center;
  69. image {
  70. width: 120rpx;
  71. height: 120rpx;
  72. margin: 20rpx;
  73. border-radius: 12rpx;
  74. //flex: 0 0 76rpx;
  75. }
  76. .right {
  77. overflow: hidden;
  78. flex: 1 0;
  79. padding: 20rpx 20rpx 20rpx 0;
  80. &_top {
  81. display: flex;
  82. justify-content: space-between;
  83. &_name {
  84. font-size: 28rpx;
  85. color: $u-main-color;
  86. flex: 0 0 450rpx;
  87. overflow: hidden;
  88. }
  89. &_time {
  90. font-size: 22rpx;
  91. color: $u-light-color;
  92. }
  93. }
  94. &_btm {
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. font-size: 22rpx;
  99. color: $u-tips-color;
  100. padding-top: 10rpx;
  101. }
  102. }
  103. }
  104. .bg_view {
  105. background-color: #fafafa;
  106. }
  107. .slot-wrap {
  108. display: flex;
  109. align-items: center;
  110. padding: 0 30rpx;
  111. }
  112. </style>