index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="box">
  3. <banner></banner>
  4. <div class="content_box">
  5. <div class="list_title">
  6. <div class="title">{{ $t("nav.Overview") }}</div>
  7. <div class="keyword_box">
  8. <el-input placeholder="Antibody" v-model="keyword" class="input-with-select">
  9. <el-button class="but_search" slot="append" icon="el-icon-search" @click="search"></el-button>
  10. </el-input>
  11. <el-button class="buttom_box" icon="el-icon-refresh" @click="reset">{{ $t("nav.reset") }}</el-button>
  12. </div>
  13. </div>
  14. <div class="list_box">
  15. <div class="list">
  16. <el-row :gutter="10" style="width: 100%;">
  17. <el-col :span="4" v-for="(one, i) in keywordList" :ref="'bt' + one.id" :key="one.id">
  18. <div class="format-box animate__animated"
  19. :class="{ 'slide-up': one.isSliding, 'list_active': row(i) }"
  20. v-if="!one.show"
  21. @click="gotoproduct(one)" @transitionend="onTransitionEnd(one)">
  22. <div class="images_box">
  23. <p class="images_title">{{ one.catalog }}</p>
  24. <img class="icons-item-imgbox" :src="one.coverUrl">
  25. <p class="images_weight">{{ one.name }}</p>
  26. <p class="images_text">{{ one.moa }} </p>
  27. <p class="images_text">{{ one.proteinWeight }}</p>
  28. <p class="images_text">({{ one.company }})</p>
  29. <p class="images_footer">{{ one.country }}{{ one.stage ? ',' : '' }} {{ one.stage }}{{ one.year ? "(" + one.year + ")"
  30. : '' }}</p>
  31. </div>
  32. </div>
  33. </el-col>
  34. </el-row>
  35. </div>
  36. <div class="title_box" v-if="issshow">{{ $t("nav.other") }} {{ $t("nav.Overview") }}</div>
  37. <div class="list">
  38. <el-row :gutter="10" style="width: 100%;">
  39. <el-col :span="4" v-for="(one, i) in otherList" :ref="'bt' + one.id" :key="one.id">
  40. <div class="format-box animate__animated"
  41. :class="{ 'slide-up': one.isSliding, 'list_active': row(i) }"
  42. v-if="!one.show"
  43. @click="gotoproduct(one)" @transitionend="onTransitionEnd(one)">
  44. <div class="images_box">
  45. <p class="images_title">{{ one.catalog }}</p>
  46. <img class="icons-item-imgbox" :src="one.coverUrl">
  47. <p class="images_weight">{{ one.name }}</p>
  48. <p class="images_text">{{ one.moa }} </p>
  49. <p class="images_text">{{ one.proteinWeight }}</p>
  50. <p class="images_text">({{ one.company }})</p>
  51. <p class="images_footer">{{ one.country }}{{ one.stage ? ',' : '' }} {{ one.stage }}{{ one.year ? "(" + one.year + ")"
  52. : '' }}</p>
  53. </div>
  54. </div>
  55. </el-col>
  56. </el-row>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import banner from "@/components/banner";
  64. import "animate.css";
  65. export default {
  66. name: "overView",
  67. components: {
  68. banner
  69. },
  70. data() {
  71. return {
  72. keyword: "",
  73. overView: [], // 原数组
  74. keywordList: [], // 搜索数组
  75. otherList: [], //
  76. // 是否搜索
  77. issshow: false,
  78. showBackToTop: false,
  79. };
  80. },
  81. methods: {
  82. // 过度是否结束
  83. onTransitionEnd(block) {
  84. console.log(block.isSliding, "过度是否结束", this.overView.length, "overView====原数组", this.keywordList.length, "keywordList====搜索数组", this.otherList.length, "otherList====");
  85. if (block.isSliding) {
  86. block.isSliding = false;
  87. if (this.isBlockInArray(block, this.otherList)) {
  88. this.otherList = this.otherList.filter(b => b.catalog !== block.catalog || b.name !== block.name || b.target !== block.target || b.moa !== block.moa);
  89. this.keywordList.push(block);
  90. block.styleOpacity = "0"
  91. setTimeout(() => {
  92. block.styleOpacity = "1"
  93. }, 50);
  94. }
  95. }
  96. },
  97. // 重置
  98. reset() {
  99. this.keywordList = []
  100. this.keyword = ""
  101. this.issshow = false
  102. this.changeSearchAll()
  103. },
  104. // 搜索
  105. isBlockInArray(block, array) {
  106. return array.some(b => b.catalog === block.catalog || b.name === block.name || b.target === block.target || b.moa === block.moa);
  107. },
  108. search() {
  109. let list = []
  110. list.concat(this.overView)
  111. this.otherList = this.overView
  112. console.log(this.overView.length, "overView====原数组", this.keywordList.length, "keywordList====搜索数组", this.otherList.length, "otherList====");
  113. // 回到顶部
  114. document.body.scrollTop = 0;
  115. const keyword = this.keyword.trim().toLowerCase();
  116. this.keywordList = []
  117. this.issshow = true
  118. if (keyword === "") return;
  119. let matchCount = 0;
  120. // 搜索条件 name,catalog, target, moa
  121. this.overView.forEach(block => {
  122. if (block.name.toLowerCase().includes(keyword.toLowerCase()) || block.catalog.toLowerCase().includes(keyword.toLowerCase()) || block.target.toLowerCase().includes(keyword.toLowerCase()) || block.moa.toLowerCase().includes(keyword.toLowerCase())) {
  123. if (block.isSliding) return;
  124. setTimeout(() => {
  125. block.isSliding = true;
  126. }, matchCount * 300);
  127. matchCount++;
  128. }
  129. });
  130. },
  131. // 判断是第几列数据
  132. row(i) {
  133. let num = Math.floor(i / 6) % 2
  134. return num == 1 ? false : true
  135. },
  136. changeSearchAll() {
  137. this.$api.post("/basb/searchAll", {
  138. articleFlag: 0
  139. }).then(res => {
  140. let list = res.data
  141. for (let i = 0; i < list.length; i++) {
  142. list[i].isSliding = false
  143. }
  144. this.overView = list
  145. this.otherList = list
  146. })
  147. },
  148. // 调整详情
  149. gotoproduct(item) {
  150. let name = this.$util.english(item.productName);
  151. let title = "antibody"
  152. this.$router.push({
  153. path: "/products/" + title + "/" + name + "/" + item.catalog
  154. });
  155. },
  156. handleScroll() {
  157. // 当滚动距离超过 300px 时显示回到顶部按钮
  158. this.showBackToTop = window.scrollY > 300;
  159. }
  160. },
  161. created() {
  162. this.changeSearchAll()
  163. }
  164. };
  165. </script>
  166. <style lang="scss" scoped>
  167. @media screen and (min-width: 751px) and (max-width: 9999px) {
  168. .box {
  169. .content_box {
  170. width: 1200px;
  171. margin: auto;
  172. }
  173. .list_title {
  174. // width: 1200px;
  175. // margin: 30px auto 0;
  176. padding-top: 30px;
  177. padding-bottom: 30px;
  178. font-size: 18px;
  179. font-weight: 600;
  180. display: flex;
  181. align-items: center;
  182. background-color: #fff;
  183. position: sticky;
  184. top: 80px;
  185. z-index: 999;;
  186. .keyword_box {
  187. width: 50%;
  188. display: flex;
  189. align-items: center;
  190. margin-left: 40px;
  191. .input-with-select /deep/ {
  192. margin-right: 20px;
  193. .el-input__inner {
  194. border-color: #007BC4 !important;
  195. border-right: none !important;
  196. }
  197. .el-input-group__append {
  198. border-color: #007BC4 !important;
  199. border-left: none !important;
  200. }
  201. .but_search {
  202. background-color: #007BC4;
  203. border: #007BC4;
  204. color: #fff;
  205. }
  206. }
  207. .buttom_box {
  208. background-color: #007BC4;
  209. border: #007BC4;
  210. color: #fff;
  211. }
  212. }
  213. }
  214. .list_box {
  215. width: 1200px;
  216. margin: 0 auto 90px;
  217. display: flex;
  218. align-items: center;
  219. flex-wrap: wrap;
  220. // max-height: 600px;
  221. // overflow-y: auto;
  222. // overflow-x: hidden;
  223. }
  224. .title_box {
  225. line-height: 40px;
  226. margin-top: 10px;
  227. }
  228. .list {
  229. width: 100%;
  230. // display: flex;
  231. // align-items: center;
  232. // flex-wrap: wrap;
  233. background-color: #fff;
  234. .format-box {
  235. // width: 16.5%;
  236. border: 1px solid #DDDDDD;
  237. transition: transform 0.3s ease;
  238. margin-bottom: 10px;
  239. .images_box {
  240. padding: 8px;
  241. box-sizing: border-box;
  242. text-align: center;
  243. .images_title {
  244. font-size: 12px;
  245. font-weight: 600;
  246. text-align: left;
  247. }
  248. .images_weight {
  249. font-size: 14px;
  250. font-weight: 600;
  251. margin-bottom: 10px;
  252. // height: 40px;
  253. }
  254. .images_text {
  255. font-size: 12px;
  256. height: 20rpx;
  257. white-space: nowrap; /* 防止文本换行 */
  258. overflow: hidden; /* 隐藏溢出的内容 */
  259. text-overflow: ellipsis;
  260. }
  261. .images_footer {
  262. font-size: 12px;
  263. margin-top: 10px;
  264. height: 20rpx;
  265. }
  266. .icons-item-imgbox {
  267. width: 100%;
  268. height: 160px;
  269. }
  270. }
  271. }
  272. .bg-color {
  273. background-color: #007BC4;
  274. }
  275. .format-box:hover {
  276. transform-origin: 0% 0;
  277. transform: scale(1.2);
  278. border: 1px solid #007BC4;
  279. background: #fff;
  280. z-index: 999;
  281. }
  282. }
  283. .list_active {
  284. background-color: #F0FAFE;
  285. &:hover {
  286. transform-origin: 0% 0;
  287. transform: scale(1.2);
  288. border: 1px solid #007BC4;
  289. background: #F0FAFE !important;
  290. z-index: 999;
  291. }
  292. }
  293. }
  294. .slide-up {
  295. // transform: translateY(-100%);
  296. // opacity: 0;
  297. transform: translateY(-100px) rotate(360deg) scale(1.1);
  298. opacity: 0.8;
  299. }
  300. }
  301. // 滚动条样式
  302. ::-webkit-scrollbar {
  303. width: 4px;
  304. background-color: #B6D1E6;
  305. }
  306. ::-webkit-scrollbar-thumb {
  307. border-radius: 5px;
  308. background-color: #0B72C1;
  309. }
  310. </style>