sharePage.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div class="share-page">
  3. <custom-header name="选择发送到" />
  4. <div class="share-content">
  5. <div class="search-wrap">
  6. <div class="search-input">
  7. <el-input v-model="search" placeholder="搜索昵称">
  8. <template #prefix>
  9. <el-icon><Search /></el-icon>
  10. </template>
  11. </el-input>
  12. </div>
  13. </div>
  14. <div class="recent-chat-wrap">
  15. <div class="recent-title">最近聊天</div>
  16. <div class="recent-list">
  17. <div class="recent-item" v-for="(item, index) in recentList" :key="index">
  18. <img class="recent-img" src="" alt="" />
  19. <div class="recent-name">{{ item.name }}</div>
  20. <checkbox class="recent-checkbox" v-model="item.checked"></checkbox>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="chat-list">
  25. <div class="chat-item" v-for="(item, index) in chatList" :key="index">
  26. <checkbox @change="changeCheck(item)" v-model="item.checked"></checkbox>
  27. <div class="chat-info" :class="{'checked': item.checked}">
  28. <img class="chat-img" src="" alt="" />
  29. <span class="chat-name">{{ item.name }}</span>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="bottom-btn" v-show="checkedList.length > 0">
  36. <div class="btn">取消</div>
  37. <div class="btn primary">完成</div>
  38. </div>
  39. </template>
  40. <script setup>
  41. import customHeader from "@/components/customHeader.vue";
  42. import { Checkbox } from "vant";
  43. import { ref } from "vue";
  44. const search = ref("");
  45. const chatList = ref([
  46. {
  47. name: "张三",
  48. checked: false,
  49. },
  50. {
  51. name: "张三",
  52. checked: false,
  53. },
  54. ]);
  55. const recentList = ref([
  56. {
  57. name: "农资11",
  58. checked: false,
  59. },
  60. {
  61. name: "农资12",
  62. checked: false,
  63. },
  64. ]);
  65. const checkedList = ref([]);
  66. const changeCheck = (item) => {
  67. console.log(item,chatList.value);
  68. checkedList.value = chatList.value.filter((item) => item.checked);
  69. };
  70. </script>
  71. <style lang="scss" scoped>
  72. .share-page {
  73. width: 100%;
  74. height: 100vh;
  75. background-color: #f5f7fb;
  76. .share-content {
  77. .search-wrap {
  78. padding: 20px 20px 0 20px;
  79. .search-input {
  80. width: 100%;
  81. ::v-deep {
  82. .el-input__wrapper {
  83. box-shadow: none;
  84. border-radius: 25px;
  85. }
  86. }
  87. }
  88. }
  89. .recent-chat-wrap {
  90. padding: 0 20px 20px 20px;
  91. .recent-title {
  92. font-weight: 500;
  93. margin: 12px 0;
  94. }
  95. .recent-list {
  96. display: flex;
  97. flex-wrap: wrap;
  98. gap: 10px;
  99. .recent-item {
  100. position: relative;
  101. .recent-img {
  102. width: 54px;
  103. height: 54px;
  104. border-radius: 2px;
  105. background: red;
  106. }
  107. .recent-name {
  108. text-align: center;
  109. margin-top: 5px;
  110. }
  111. .recent-checkbox{
  112. position: absolute;
  113. right: 3px;
  114. top: 3px;
  115. }
  116. }
  117. }
  118. }
  119. .chat-list {
  120. background-color: #fff;
  121. padding-top: 6px;
  122. .chat-item {
  123. padding: 10px 20px;
  124. display: flex;
  125. align-items: center;
  126. gap: 12px;
  127. .chat-info {
  128. display: flex;
  129. align-items: center;
  130. gap: 10px;
  131. .chat-img {
  132. width: 46px;
  133. height: 46px;
  134. border-radius: 2px;
  135. }
  136. &.checked {
  137. .chat-name {
  138. color: #2199F8;
  139. font-weight: 500;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. .bottom-btn {
  148. position: fixed;
  149. bottom: 10px;
  150. left: 20px;
  151. width: calc(100% - 40px);
  152. display: flex;
  153. .btn {
  154. flex: 1;
  155. text-align: center;
  156. color: #2199F8;
  157. padding: 10px;
  158. border-radius: 25px;
  159. border: 1px solid #2199F8;
  160. font-size: 16px;
  161. &.primary{
  162. background: #2199F8;
  163. color: #fff;
  164. }
  165. }
  166. .btn + .btn {
  167. margin-left: 15px;
  168. }
  169. }
  170. </style>