1
0

HomeView.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <script setup>
  2. import { ref, onMounted } from "vue";
  3. import { useRouter } from "vue-router";
  4. import banner1 from "../assets/banner1.jpg";
  5. import banner2 from "../assets/banner2.jpg";
  6. import banner3 from "../assets/banner3.jpg";
  7. import banner4 from "../assets/banner4.jpg";
  8. const active = ref(0);
  9. const value = ref("");
  10. const images = ref([
  11. { url: banner1 },
  12. { url: banner2 },
  13. { url: banner3 },
  14. { url: banner4 },
  15. ]);
  16. const router = useRouter();
  17. const handleDetail = () => {
  18. router.push("/detail");
  19. };
  20. onMounted(() => {
  21. localStorage.removeItem("chatHistory");
  22. localStorage.removeItem("status");
  23. });
  24. </script>
  25. <template>
  26. <div class="home">
  27. <!-- 人物头像 -->
  28. <div class="avatar">
  29. <header>
  30. <img src="../assets/head.jpg" alt="" />
  31. <div class="head_content">
  32. <span>Chris B</span>
  33. <span>探索未知,发现自我~</span>
  34. </div>
  35. </header>
  36. <div class="search">
  37. <van-search v-model="value" placeholder="搜索" />
  38. </div>
  39. <div class="banner">
  40. <van-swipe :autoplay="3000">
  41. <van-swipe-item v-for="(image, index) in images" :key="index">
  42. <div class="image-wrapper">
  43. <img :src="image.url" alt="轮播图片" />
  44. <div class="text-wrapper">
  45. <div>模拟对话场景,提升业务能力</div>
  46. <button>查看任务</button>
  47. </div>
  48. </div>
  49. </van-swipe-item>
  50. </van-swipe>
  51. </div>
  52. <div class="card_list">
  53. <p>陪练课程</p>
  54. <div class="card_content">
  55. <div class="card_item" @click="handleDetail()">
  56. <img src="../assets/role3.jpg" alt="" />
  57. <p>电话销售</p>
  58. <span>电话销售场景</span>
  59. </div>
  60. <div class="card_item">
  61. <img src="../assets/role2.jpg" alt="" />
  62. <p>电话销售</p>
  63. <span>电话销售场景</span>
  64. </div>
  65. <div class="card_item">
  66. <img src="../assets/role1.jpg" alt="" />
  67. <p>电话销售</p>
  68. <span>电话销售场景</span>
  69. </div>
  70. <div class="card_item">
  71. <img src="../assets/role.jpg" alt="" />
  72. <p>电话销售</p>
  73. <span>电话销售场景</span>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <!-- 底部tabbar -->
  79. <div style="visibility: hidden; height: 50px"></div>
  80. <van-tabbar v-model="active">
  81. <van-tabbar-item name="home" icon="home-o">首页</van-tabbar-item>
  82. <van-tabbar-item name="friends" icon="contact-o">我的</van-tabbar-item>
  83. </van-tabbar>
  84. </div>
  85. </template>
  86. <style scoped lang="less">
  87. p {
  88. margin: 0;
  89. padding: 0;
  90. }
  91. html {
  92. touch-action: manipulation;
  93. /* 禁止双指缩放 */
  94. }
  95. @media (max-width: 767px) {
  96. html {
  97. touch-action: pan-y;
  98. /* 允许垂直滚动,禁止水平滚动和缩放 */
  99. }
  100. }
  101. .avatar {
  102. padding: 0 1.38rem;
  103. header {
  104. padding: 1.31rem 0;
  105. display: flex;
  106. align-items: center;
  107. img {
  108. width: 3.13rem;
  109. height: 3.13rem;
  110. border-radius: 6.25rem;
  111. background-color: rgba(229, 229, 229, 1);
  112. box-shadow: 0rem 0.5rem 1.5rem 0rem rgba(92, 117, 169, 0.4);
  113. margin-right: 1.25rem;
  114. }
  115. .head_content {
  116. display: flex;
  117. flex-direction: column;
  118. span {
  119. line-height: 1.44rem;
  120. color: rgba(16, 16, 16, 1);
  121. font-size: 1rem;
  122. text-align: left;
  123. font-family: PingFangSC-medium;
  124. }
  125. span:nth-child(2) {
  126. color: rgba(102, 102, 102, 0.7);
  127. font-size: 0.88rem;
  128. line-height: 1.25rem;
  129. }
  130. }
  131. }
  132. .search {
  133. .van-search {
  134. width: 100%;
  135. height: 2.5rem;
  136. padding: 0;
  137. }
  138. :deep(.van-search__content) {
  139. border-radius: 0.5rem;
  140. }
  141. }
  142. .banner {
  143. margin: 1.25rem 0 1.25rem 0;
  144. }
  145. .image-wrapper {
  146. position: relative;
  147. width: 100%;
  148. height: 8.75rem;
  149. border-radius: 0.75rem;
  150. overflow: hidden;
  151. img {
  152. width: 100%;
  153. height: auto;
  154. object-fit: cover;
  155. }
  156. .text-wrapper {
  157. position: absolute;
  158. left: 0.88rem;
  159. top: 2.19rem;
  160. line-height: 1.56rem;
  161. color: rgba(255, 255, 255, 1);
  162. font-size: 1.13rem;
  163. text-align: left;
  164. font-family: Times New Roman-regular;
  165. button {
  166. margin-top: 1.44rem;
  167. width: 5.25rem;
  168. height: 1.75rem;
  169. border: 1px solid rgba(255, 255, 255, 1);
  170. line-height: 1.06rem;
  171. border-radius: 0.38rem;
  172. background-color: rgba(255, 255, 255, 1);
  173. color: rgba(9, 52, 74, 1);
  174. font-size: 0.75rem;
  175. text-align: center;
  176. font-family: -regular;
  177. }
  178. }
  179. }
  180. .card_list {
  181. p {
  182. line-height: 1.44rem;
  183. color: rgba(16, 16, 16, 1);
  184. font-size: 1rem;
  185. text-align: left;
  186. font-family: Times New Roman-regular;
  187. margin-bottom: 0.38rem;
  188. }
  189. .card_content {
  190. display: flex;
  191. flex-wrap: wrap;
  192. justify-content: space-between;
  193. /* margin-top: 1.25rem; */
  194. }
  195. .card_item {
  196. width: 47%;
  197. height: 13.75rem;
  198. background-color: rgba(255, 255, 255, 1);
  199. box-shadow: 0rem 0.06rem 0.88rem 0rem rgba(0, 1, 130, 0.08);
  200. border-radius: 0.75rem;
  201. overflow: hidden;
  202. margin-bottom: 1rem;
  203. img {
  204. width: 100%;
  205. height: 9.75rem;
  206. object-fit: cover;
  207. }
  208. p {
  209. margin: 0.63rem 0 0 0.63rem;
  210. line-height: 1.25rem;
  211. color: rgba(16, 16, 16, 1);
  212. font-size: 0.88rem;
  213. text-align: left;
  214. font-family: PingFangSC-medium;
  215. }
  216. span {
  217. line-height: 1.06rem;
  218. color: rgba(102, 102, 102, 1);
  219. font-size: 0.75rem;
  220. text-align: left;
  221. font-family: PingFangSC-regular;
  222. margin-left: 0.63rem;
  223. }
  224. }
  225. // @media (min-width: 600px) {
  226. // .card {
  227. // width: 50%;
  228. // height: 400px;
  229. // }
  230. // }
  231. }
  232. }
  233. </style>